一直以來在 VB
而在
這些天在優化程序時發現 當傳送 大變量時
如傳入的參數變量類型 是 大字符串
測試的關鍵代碼如下
Private Declare Function GetTickCount Lib "kernel
Private Function TestByRef(ByRef aa As String) As String
aa = "
TestByRef = aa
End Function
Private Function TestByVal(ByVal aa As String) As String
aa = "
TestByVal = aa
End Function
Private Sub Button
Dim teststr As String
Dim Newstr As String
Dim t As Int
Dim II As Int
teststr = "wosdfsdfdsfdsfsfdsfsfsfsfsfsfdsfdsfcvxcvxcvcxvvcxvvvxvcvxv"
t = GetTickCount
For II =
Newstr = TestByRef(teststr)
Next
MsgBox("ByRef " & CStr(GetTickCount
t = GetTickCount
For II =
Newstr = TestByVal(teststr)
Next
MsgBox("ByVal " & CStr(GetTickCount
End Sub
From:http://tw.wingwit.com/Article/program/net/201311/14102.html