IonicWind Software

Creative Basic => GUI Programs => Topic started by: aurelCB on August 11, 2009, 05:46:41 AM

Title: Read strings from file
Post by: aurelCB on August 11, 2009, 05:46:41 AM
Hi...
Title: Re: Read strings from file
Post by: ZeroDog on August 11, 2009, 10:27:55 AM
QuoteIs faster way use WHILE/ENDWILE loop instead DO/UNTIL ?

They should be about the same.  I think the difference between the two is that with a DO/UNTIL loop it checks the conditional flag of the loop EOF(file1) at the end of the loop, and the WHILE/ENDWHILE checks the conditional flag at the start of the loop. 

You could always time how long each loop takes using the GetTickCount API function.


DECLARE "kernel32.dll", GetTickCount(),int

TicksBeforeLoop=GetTickCount()
Do
  'read contents of file here
Until EOF(file1)
TicksAfterLoop=GetTickCount()
MillisecondsItTookForLoop=TicksAfterLoop-TicksBeforeLoop



Title: Re: Read strings from file
Post by: ZeroDog on August 11, 2009, 08:36:59 PM
if you time one cycle of the while loop, is it 10 milliseconds?
Title: Re: Read strings from file
Post by: Ionic Wind Support Team on August 12, 2009, 03:48:26 AM
GetTickCount only has a resolution of 10ms, so it's not very useful for timing one iteration of code.  Run 1000 iterations of each.