dexto Posted July 7, 2011 Posted July 7, 2011 (edited) Current project has me sending files over TCP.Standard routine:; Combine For $i = $iStart To $iEnd $sResult &= $avArray[$i] NextWorks fine, but if you think about, in the background each time you call &= it copies entire string in memory deletes old one.. so on... It would be so much easier to sleep if you could put each chank of a stream in array and in the end join all of it at the same time (true Array Join).Any though or suggestions?I'm looking into DllStructCreate to somehow to be able to read memory array into a string (char array) Edited July 7, 2011 by dexto
MvGulik Posted July 8, 2011 Posted July 8, 2011 (edited) Any though or suggestions?Other than a lot of ??? and wondering about what problem you suggestion is suppose to fix (if any). Nope. Edited July 8, 2011 by iEvKI3gv9Wrkd41u "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ...
dexto Posted July 8, 2011 Author Posted July 8, 2011 Other than a lot of ??? and wondering about what problem you suggestion is suppose to fix (if any). Nope.Its not really a usability problem.When you deal with large file transfers such as 50mb to 100mb adding to 100mb 1k at a time while copying enter variable over and over isn't the most efficient way. There could be a better way to execute such a common routine.
MvGulik Posted July 8, 2011 Posted July 8, 2011 (edited) You main you where trying to dump 50..100MB in data from a array into a string ... O dear.Why don't you just dump the data to a file first, and than send that file. (?)---Corrections:1) ... 100MB in data from a array (with a total of 100MB of data stored in small part in lots of elements) into a string (one element at a time)2) ... dump the data (directly from the array, per element of course) to a file first, and than send that file. (?)+ Not going to guess what "this" might be at #6 Edited July 8, 2011 by iEvKI3gv9Wrkd41u "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ...
dexto Posted July 8, 2011 Author Posted July 8, 2011 (edited) You main you where trying to dump 50..100MB in data from a array into a string ... O dear.Why don't you just dump the data to a file first, and than send that file. (?)Its more like 1b to 100mb... I don't really see a problem with 100mb in memory for a min or so in return for speed.EDIT: You make it sound like string is different from any other peace of data and is limited by quotes.. but no matter.File..? I'm not using file its real time network packet processing in chunks. You should know that RAM is faster then hard drive. Edited July 12, 2011 by dexto
dexto Posted July 12, 2011 Author Posted July 12, 2011 (edited) FYI: Writing to hard drive is about 8 times faster using &= in RAM To file: local $f = FileOpen('c:\test',1+16) While $ldata > 0 $g = TCPRecv($sock, $ldata, 1) If @error Then TCPCloseSocket($sock) Return SetError(1, 0, '') EndIf FileWrite($f,$g) $ldata -= BinaryLen($g) WEnd FileClose($f) To Ram $data = '0x' While $ldata > 0 $g = TCPRecv($sock, $ldata, 1) If @error Then TCPCloseSocket($sock) Return SetError(1, 0, $header) EndIf $data &= StringTrimLeft($g, 2) $ldata -= BinaryLen($g) WEnd Edited July 12, 2011 by dexto
MvGulik Posted July 12, 2011 Posted July 12, 2011 Yep. Bad suggestion of mine. Files transfer should never be done for small chunks of data if it can be helped. Although I see you ditched the Array part. (which was the bottleneck in your case I think.) "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ...
dexto Posted July 12, 2011 Author Posted July 12, 2011 Yep. Bad suggestion of mine. Files transfer should never be done for small chunks of data if it can be helped. Although I see you ditched the Array part. (which was the bottleneck in your case I think.) Array version is the fastest yet: (but no way to concatenate without rewriting memory hundred times.) Dim $data[1000] ; for simplicity purpouse $data[0] = 1 While $ldata > 0 and $data[0]<1000 $g = TCPRecv($sock, $ldata, 1) If @error Then TCPCloseSocket($sock) Return SetError(1, 0, $header) EndIf $data[$i] = $g $data[0] += 1 $ldata -= BinaryLen($g) WEnd
SkinnyWhiteGuy Posted July 12, 2011 Posted July 12, 2011 To Ram $data = '0x' While $ldata > 0 $g = TCPRecv($sock, $ldata, 1) If @error Then TCPCloseSocket($sock) Return SetError(1, 0, $header) EndIf $data &= StringTrimLeft($g, 2) $ldata -= BinaryLen($g) WEnd This just irks me when I see it, because when you call StringTrimLeft, you are forcing AutoIt to convert the Binary type to a string type, and inside a loop, that may not be pretty. Try this instead: $data = Binary('') While $ldata > 0 $g = TCPRecv($sock, $ldata, 1) If @error Then TCPCloseSocket($sock) Return SetError(1, 0, $header) EndIf $data &= $g $ldata -= BinaryLen($g) WEnd If you want the data at the end to be a string, then you can do BinaryToString() on it just the one time.
dexto Posted July 12, 2011 Author Posted July 12, 2011 (edited) This just irks me when I see it, because when you call StringTrimLeft, you are forcing AutoIt to convert the Binary type to a string type, and inside a loop, that may not be pretty. Try this instead: $data = Binary('') While $ldata > 0 $g = TCPRecv($sock, $ldata, 1) If @error Then TCPCloseSocket($sock) Return SetError(1, 0, $header) EndIf $data &= $g $ldata -= BinaryLen($g) WEnd If you want the data at the end to be a string, then you can do BinaryToString() on it just the one time. ah yes.. my bad... typo actually it should be $data &= BinaryMid($g, 2) and it is necessary (unfortunately) since data is in binary with '0x' in the beginning Edited July 12, 2011 by dexto
SkinnyWhiteGuy Posted July 12, 2011 Posted July 12, 2011 (edited) I thought so at first too, but then I tested it before I posted first: $test = Binary('') $a = Binary("0x1122") $b = Binary("0x3344") $test &= $a $test &= $b ConsoleWrite($test & @CRLF) It Prints just this: 0x11223344 No extra 0x in the output. Edited July 12, 2011 by SkinnyWhiteGuy
dexto Posted July 12, 2011 Author Posted July 12, 2011 (edited) I thought so at first too, but then I tested it before I posted first: $test = Binary('') $a = Binary("0x1122") $b = Binary("0x3344") $test &= $a $test &= $b ConsoleWrite($test & @CRLF) It Prints just this: 0x11223344 No extra 0x in the output. oh... indeed! Lets see if this helps. EDIT: Its much slower then any other alternative at 250ms vs 25ms using file and 85ms using '0x' (same stream sent localy) $data = Binary('') While $ldata > 0 $g = TCPRecv($sock, $ldata, 1) If @error Then TCPCloseSocket($sock) Return SetError(1, 0, $header) EndIf $data &= $g $ldata -= BinaryLen($g) WEnd EDIT: I just found out that stream consisted of one packet which is interesting considering time difference but irrelevant for this test. Edited July 12, 2011 by dexto
MvGulik Posted July 12, 2011 Posted July 12, 2011 Mmm, something seems to be off. but can't put my finger on it. Anyway. I'm a sucker when it comes to timing tests. Here is a little test I did. (while running some other stuff to, so timings might effected a bit.) Some Timing run's output.expandcollapse popup$iPower = 17 {I3} (0x00.00.00.11) [0,0] $sChunk = "XXXXXXXZ" {St} [0,0] Size tt (Chr) = 1048576 {I6} (0x00.00.00.00.00.10.00.00) [0,0] Size tt (Mb) = 1 {iD} {0xDouble} [0,0] - A: String Concat --- $sData &= $sChunk - B: Array, Fill --- $aData[$i] = $sChunk - C: Array, Call data --- $sData = $aData[$i] - D: Array, Call data, +StringAdd --- $sData &= $aData[$i] --- --- 0 (array dump), , Debug_TimerQuit:[18][2]. --- |--| 0| 1| [0] |I3| 17 | 0 : 0 | [1] |St| testrun | 9.72 Sec. | [2] |St| A: String Concat [1] | 527.91 mSec. | [3] |St| A: String Concat [2] | 508.59 mSec. | [4] |St| A: String Concat [3] | 549.95 mSec. | [5] |St| A: String Concat [4] | 530.78 mSec. | [6] |St| array fill B [1] | 983.81 mSec. | [7] |St| array fill B [2] | 595.47 mSec. | [8] |St| array fill B [3] | 612.68 mSec. | [9] |St| array fill B [4] | 589.67 mSec. | [10] |St| C: Array, Call [1] | 653.48 mSec. | [11] |St| C: Array, Call [2] | 587.77 mSec. | [12] |St| C: Array, Call [3] | 621.53 mSec. | [13] |St| C: Array, Call [4] | 608.76 mSec. | [14] |St| D: Array, Call, +Concat [1] | 576.91 mSec. | [15] |St| D: Array, Call, +Concat [2] | 584.39 mSec. | [16] |St| D: Array, Call, +Concat [3] | 581.12 mSec. | [17] |St| D: Array, Call, +Concat [4] | 599.35 mSec. | --- --- 0 [0,0] $iPower = 20 {I3} (0x00.00.00.14) [0,0] $sChunk = "XXXXXXXZ" {St} [0,0] Size tt (Chr) = 8388608 {I6} (0x00.00.00.00.00.80.00.00) [0,0] Size tt (Mb) = 8 {iD} {0xDouble} [0,0] - A: String Concat --- $sData &= $sChunk - B: Array, Fill --- $aData[$i] = $sChunk - C: Array, Call data --- $sData = $aData[$i] - D: Array, Call data, +StringAdd --- $sData &= $aData[$i] --- --- 0 (array dump), , Debug_TimerQuit:[18][2]. --- |--| 0| 1| [0] |I3| 17 | 0 : 0 | [1] |St| testrun | 1.26 Min. | [2] |St| A: String Concat [1] | 4.01 Sec. | [3] |St| A: String Concat [2] | 3.69 Sec. | [4] |St| A: String Concat [3] | 3.7 Sec. | [5] |St| A: String Concat [4] | 3.7 Sec. | [6] |St| array fill B [1] | 7.46 Sec. | [7] |St| array fill B [2] | 4.83 Sec. | [8] |St| array fill B [3] | 4.8 Sec. | [9] |St| array fill B [4] | 4.8 Sec. | [10] |St| C: Array, Call [1] | 5.08 Sec. | [11] |St| C: Array, Call [2] | 4.86 Sec. | [12] |St| C: Array, Call [3] | 4.77 Sec. | [13] |St| C: Array, Call [4] | 4.76 Sec. | [14] |St| D: Array, Call, +Concat [1] | 4.96 Sec. | [15] |St| D: Array, Call, +Concat [2] | 4.79 Sec. | [16] |St| D: Array, Call, +Concat [3] | 4.6 Sec. | [17] |St| D: Array, Call, +Concat [4] | 4.62 Sec. | --- --- 0 [0,0] $iPower = 23 {I3} (0x00.00.00.17) [0,0] $sChunk = "XXXXXXXZ" {St} [0,0] Size tt (Chr) = 67108864 {I6} (0x00.00.00.00.04.00.00.00) [0,0] Size tt (Mb) = 64 {iD} {0xDouble} [0,0] - A: String Concat --- $sData &= $sChunk - B: Array, Fill --- $aData[$i] = $sChunk - C: Array, Call data --- $sData = $aData[$i] - D: Array, Call data, +StringAdd --- $sData &= $aData[$i] --- --- 0 (array dump), , Debug_TimerQuit:[6][2]. --- |--| 0| 1| [0] |I3| 5 | 0 : 0 | [1] |St| testrun | 2.82 Min. | [2] |St| A: String Concat [1] | 31.03 Sec. | [3] |St| array fill B [1] | 1 Min. | [4] |St| C: Array, Call [1] | 39.44 Sec. | [5] |St| D: Array, Call, +Concat [1] | 38.69 Sec. | --- --- 0 [0,0] Personal code -> Using local debug/timing functions.expandcollapse popupFunc test() Debug_Timer('testrun') Local $iRepeat = 4 ;; data size: 17(1mb) 20(8mb) 24(128mb) Local $iPower = 20 ;; data size: 17(1mb) 20(8mb) 24(128mb) Local $sChunk = 'XXXXXXXZ' Local $sData = $sChunk Local $iLoop = Int(2 ^ $iPower) - 1 Local $iTmp_Size = StringLen($sChunk) * Int(2 ^ $iPower) #forceref $sData DebugOut('$iPower', $iPower) ;### Debug DebugOut. DebugOut('$sChunk', $sChunk) ;### Debug DebugOut. DebugOut('Size tt (Chr)', $iTmp_Size) ;### Debug DebugOut. DebugOut('Size tt (Mb)', $iTmp_Size / 1024 / 1024) ;### Debug DebugOut. DebugOut('- A: String Concat --- $sData &= $sChunk') ;### Debug DebugOut. For $iR = 1 To $iRepeat $sData = '' Debug_Timer('A: String Concat [' & String($iR) & ']') For $i = 1 To $iLoop $sData &= $sChunk Next Debug_Timer() Next $sData = '' DebugOut('- B: Array, Fill --- $aData[$i] = $sChunk') ;### Debug DebugOut. Local $aData[$iLoop + 1] For $iR = 1 To $iRepeat Debug_Timer('array fill B [' & String($iR) & ']') For $i = 0 To $iLoop $aData[$i] = $sChunk Next Debug_Timer() Next DebugOut('- C: Array, Call data --- $sData = $aData[$i]') ;### Debug DebugOut. For $iR = 1 To $iRepeat Debug_Timer('C: Array, Call [' & String($iR) & ']') For $i = 0 To $iLoop $sData = $aData[$i] Next Debug_Timer() Next DebugOut('- D: Array, Call data, +StringAdd --- $sData &= $aData[$i]') ;### Debug DebugOut. For $iR = 1 To $iRepeat $sData = '' Debug_Timer('D: Array, Call, +Concat [' & String($iR) & ']') For $i = 0 To $iLoop $sData &= $aData[$i] Next Debug_Timer() Next Debug_Timer() DebugOut('Debug_TimerQuit', Debug_TimerQuit()) EndFunc "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ...
Zedna Posted July 12, 2011 Posted July 12, 2011 (edited) Try this $data = '0x' $data_tmp = '' $len_tmp = 0 While $ldata > 0 $g = TCPRecv($sock, $ldata, 1) If @error Then TCPCloseSocket($sock) Return SetError(1, 0, $header) EndIf $len = BinaryLen($g) $len_tmp += $len $data_tmp &= StringTrimLeft($g, 2) If $len_tmp > 10000 Then ; try other buffer sizes $data &= $data_tmp $data_tmp = '' $len_tmp = 0 EndIf $ldata -= $len WEnd If $data_tmp <> '' Then $data &= $data_tmp This way you do concatenate of big string in limited count by using temporary smaller buffer on which concatenating will be fast. Edited July 12, 2011 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
dexto Posted July 13, 2011 Author Posted July 13, 2011 (edited) Try this $data = '0x' $data_tmp = '' $len_tmp = 0 While $ldata > 0 $g = TCPRecv($sock, $ldata, 1) If @error Then TCPCloseSocket($sock) Return SetError(1, 0, $header) EndIf $len = BinaryLen($g) $len_tmp += $len $data_tmp &= StringTrimLeft($g, 2) If $len_tmp > 10000 Then ; try other buffer sizes $data &= $data_tmp $data_tmp = '' $len_tmp = 0 EndIf $ldata -= $len WEnd If $data_tmp <> '' Then $data &= $data_tmp This way you do concatenate of big string in limited count by using temporary smaller buffer on which concatenating will be fast. Since data returned by TCPrecv is about 22k bytes. So, had to mod it a bit (see mod below) but even then becomes slightly slower. Anyone know if there is external data structure accessible? (Guru meditation: http://msdn.microsoft.com/en-us/library/aa366537%28v=vs.85%29.aspx) Here is a mod of your idea: $data = '0x' local $data_tmp = '' local $tmp_len = 0 local $data_len = 0 local $len While $ldata > 0 $g = TCPRecv($sock, $ldata, 1) If @error Then TCPCloseSocket($sock) Return SetError(1, 0, $header) EndIf $len = BinaryLen($g) ;ConsoleWrite($len&' bytes' & @CRLF) $tmp_len += $len $data_tmp &= StringTrimLeft($g, 2) If $tmp_len > $data_len Then ; try other buffer sizes $data &= $data_tmp $data_tmp = '' $data_len += $tmp_len $tmp_len = 0 EndIf $ldata -= $len WEnd If $tmp_len Then $data &= $data_tmp Mmm, something seems to be off. but can't put my finger on it. Anyway. I'm a sucker when it comes to timing tests. Here is a little test I did. (while running some other stuff to, so timings might effected a bit.) Some Timing run's output.expandcollapse popup$iPower = 17 {I3} (0x00.00.00.11) [0,0] $sChunk = "XXXXXXXZ" {St} [0,0] Size tt (Chr) = 1048576 {I6} (0x00.00.00.00.00.10.00.00) [0,0] Size tt (Mb) = 1 {iD} {0xDouble} [0,0] - A: String Concat --- $sData &= $sChunk - B: Array, Fill --- $aData[$i] = $sChunk - C: Array, Call data --- $sData = $aData[$i] - D: Array, Call data, +StringAdd --- $sData &= $aData[$i] --- --- 0 (array dump), , Debug_TimerQuit:[18][2]. --- |--| 0| 1| [0] |I3| 17 | 0 : 0 | [1] |St| testrun | 9.72 Sec. | [2] |St| A: String Concat [1] | 527.91 mSec. | [3] |St| A: String Concat [2] | 508.59 mSec. | [4] |St| A: String Concat [3] | 549.95 mSec. | [5] |St| A: String Concat [4] | 530.78 mSec. | [6] |St| array fill B [1] | 983.81 mSec. | [7] |St| array fill B [2] | 595.47 mSec. | [8] |St| array fill B [3] | 612.68 mSec. | [9] |St| array fill B [4] | 589.67 mSec. | [10] |St| C: Array, Call [1] | 653.48 mSec. | [11] |St| C: Array, Call [2] | 587.77 mSec. | [12] |St| C: Array, Call [3] | 621.53 mSec. | [13] |St| C: Array, Call [4] | 608.76 mSec. | [14] |St| D: Array, Call, +Concat [1] | 576.91 mSec. | [15] |St| D: Array, Call, +Concat [2] | 584.39 mSec. | [16] |St| D: Array, Call, +Concat [3] | 581.12 mSec. | [17] |St| D: Array, Call, +Concat [4] | 599.35 mSec. | --- --- 0 [0,0] $iPower = 20 {I3} (0x00.00.00.14) [0,0] $sChunk = "XXXXXXXZ" {St} [0,0] Size tt (Chr) = 8388608 {I6} (0x00.00.00.00.00.80.00.00) [0,0] Size tt (Mb) = 8 {iD} {0xDouble} [0,0] - A: String Concat --- $sData &= $sChunk - B: Array, Fill --- $aData[$i] = $sChunk - C: Array, Call data --- $sData = $aData[$i] - D: Array, Call data, +StringAdd --- $sData &= $aData[$i] --- --- 0 (array dump), , Debug_TimerQuit:[18][2]. --- |--| 0| 1| [0] |I3| 17 | 0 : 0 | [1] |St| testrun | 1.26 Min. | [2] |St| A: String Concat [1] | 4.01 Sec. | [3] |St| A: String Concat [2] | 3.69 Sec. | [4] |St| A: String Concat [3] | 3.7 Sec. | [5] |St| A: String Concat [4] | 3.7 Sec. | [6] |St| array fill B [1] | 7.46 Sec. | [7] |St| array fill B [2] | 4.83 Sec. | [8] |St| array fill B [3] | 4.8 Sec. | [9] |St| array fill B [4] | 4.8 Sec. | [10] |St| C: Array, Call [1] | 5.08 Sec. | [11] |St| C: Array, Call [2] | 4.86 Sec. | [12] |St| C: Array, Call [3] | 4.77 Sec. | [13] |St| C: Array, Call [4] | 4.76 Sec. | [14] |St| D: Array, Call, +Concat [1] | 4.96 Sec. | [15] |St| D: Array, Call, +Concat [2] | 4.79 Sec. | [16] |St| D: Array, Call, +Concat [3] | 4.6 Sec. | [17] |St| D: Array, Call, +Concat [4] | 4.62 Sec. | --- --- 0 [0,0] $iPower = 23 {I3} (0x00.00.00.17) [0,0] $sChunk = "XXXXXXXZ" {St} [0,0] Size tt (Chr) = 67108864 {I6} (0x00.00.00.00.04.00.00.00) [0,0] Size tt (Mb) = 64 {iD} {0xDouble} [0,0] - A: String Concat --- $sData &= $sChunk - B: Array, Fill --- $aData[$i] = $sChunk - C: Array, Call data --- $sData = $aData[$i] - D: Array, Call data, +StringAdd --- $sData &= $aData[$i] --- --- 0 (array dump), , Debug_TimerQuit:[6][2]. --- |--| 0| 1| [0] |I3| 5 | 0 : 0 | [1] |St| testrun | 2.82 Min. | [2] |St| A: String Concat [1] | 31.03 Sec. | [3] |St| array fill B [1] | 1 Min. | [4] |St| C: Array, Call [1] | 39.44 Sec. | [5] |St| D: Array, Call, +Concat [1] | 38.69 Sec. | --- --- 0 [0,0] Personal code -> Using local debug/timing functions.expandcollapse popupFunc test() Debug_Timer('testrun') Local $iRepeat = 4 ;; data size: 17(1mb) 20(8mb) 24(128mb) Local $iPower = 20 ;; data size: 17(1mb) 20(8mb) 24(128mb) Local $sChunk = 'XXXXXXXZ' Local $sData = $sChunk Local $iLoop = Int(2 ^ $iPower) - 1 Local $iTmp_Size = StringLen($sChunk) * Int(2 ^ $iPower) #forceref $sData DebugOut('$iPower', $iPower) ;### Debug DebugOut. DebugOut('$sChunk', $sChunk) ;### Debug DebugOut. DebugOut('Size tt (Chr)', $iTmp_Size) ;### Debug DebugOut. DebugOut('Size tt (Mb)', $iTmp_Size / 1024 / 1024) ;### Debug DebugOut. DebugOut('- A: String Concat --- $sData &= $sChunk') ;### Debug DebugOut. For $iR = 1 To $iRepeat $sData = '' Debug_Timer('A: String Concat [' & String($iR) & ']') For $i = 1 To $iLoop $sData &= $sChunk Next Debug_Timer() Next $sData = '' DebugOut('- B: Array, Fill --- $aData[$i] = $sChunk') ;### Debug DebugOut. Local $aData[$iLoop + 1] For $iR = 1 To $iRepeat Debug_Timer('array fill B [' & String($iR) & ']') For $i = 0 To $iLoop $aData[$i] = $sChunk Next Debug_Timer() Next DebugOut('- C: Array, Call data --- $sData = $aData[$i]') ;### Debug DebugOut. For $iR = 1 To $iRepeat Debug_Timer('C: Array, Call [' & String($iR) & ']') For $i = 0 To $iLoop $sData = $aData[$i] Next Debug_Timer() Next DebugOut('- D: Array, Call data, +StringAdd --- $sData &= $aData[$i]') ;### Debug DebugOut. For $iR = 1 To $iRepeat $sData = '' Debug_Timer('D: Array, Call, +Concat [' & String($iR) & ']') For $i = 0 To $iLoop $sData &= $aData[$i] Next Debug_Timer() Next Debug_Timer() DebugOut('Debug_TimerQuit', Debug_TimerQuit()) EndFunc I love test myself... So it seems that there is not much of a difference except array is not doing very well. Edited July 13, 2011 by dexto
dexto Posted July 13, 2011 Author Posted July 13, 2011 In conclusion, thank you guys for your help ideas and thing to keep in mind. Here are the results CPU i7@4Ghz: Local $f = FileOpen($data, $writeMode + 16) If @error Then Return SetError(6, 0, $header) While $l > 0 $g = TCPRecv($s, $l, 1) If @error Then TCPCloseSocket($s) Return SetError(7, 0, $header) EndIf $l -= BinaryLen($g) FileWrite($f, $g) WEnd DATA HEAD C:\Program Files\AutoIt3\autoit3.exe 4.84683897067344 ms 745336 bytes 146.653892 MB/s DATA HEAD C:\Program Files\AutoIt3\autoit3.exe 4.74903023064506 ms 745336 bytes 149.674305 MB/s DATA HEAD C:\Program Files\AutoIt3\autoit3.exe 3.68145213567248 ms 745336 bytes 193.078105 MB/s DATA HEAD C:\Program Files\AutoIt3\autoit3.exe 3.67772335672712 ms 745336 bytes 193.273863 MB/s DATA HEAD C:\Program Files\AutoIt3\autoit3.exe 4.63802734973308 ms 745336 bytes 153.256492 MB/s $data = '' While $l > 0 $g = TCPRecv($s, $l, 1) If @error Then TCPCloseSocket($s) Return SetError(8, 0, $header) EndIf $l -= BinaryLen($g) $data &= $g WEnd If $BtS > 0 Then $data = BinaryToString($data, $BtS) EndIf DATA HEAD C:\Program Files\AutoIt3\autoit3.exe 13.1410774909104 ms 745336 bytes 54.090527 MB/s DATA HEAD C:\Program Files\AutoIt3\autoit3.exe 13.0814170277846 ms 745336 bytes 54.337217 MB/s DATA HEAD C:\Program Files\AutoIt3\autoit3.exe 9.94235881408767 ms 745336 bytes 71.492873 MB/s DATA HEAD C:\Program Files\AutoIt3\autoit3.exe 7.7303324120381 ms 745336 bytes 91.950483 MB/s DATA HEAD C:\Program Files\AutoIt3\autoit3.exe 8.81999635153322 ms 745336 bytes 80.590487 MB/s
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now