[Gambas-user] Question about read/write file performance
Phạm Quang Dương
soleilpqd at ...626...
Thu Nov 25 13:49:45 CET 2010
Hi,
Maybe this is a basic question. I have 2 scripts like this:
Code 1:
Dim buff as *Byte*
sizeOfFile = Stat("aBigFile").Size
hFile = Open "aBigFile" for read
For i = 1 to sizeOfFile
Read hFile, buff
Next
Close hFile
Code 2:
Dim buff as *Byte*
Dim bigBuff as *Float*
sizeOfFile = Stat("aBigFile").Size
hFile = Open "aBigFile" for read
For i = 1 to sizeOfFile / 8
Read hFile, bigBuff
Next
For i = 1 to sizeOfFile MOD 8
Read hFile, buff
Next
Close hFile
Code 1 take t1 time unit to finish, code 2 is t2.
Are t1, t2 different? Which can be faster?
More information about the User
mailing list