Re: [CPU war] Speed question for strings

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [CPU war] Speed question for strings

L505
Which is faster, reading a file Character by Character, by Memory Block, or by
StringList.text?

--------------------------------------------------------
Welcome to the CPU war for StrLoadFile.. Please wait...

test 1 execution time: 9356007 <-- char by char
test 2 execution time: 259683  <-- blockread 1
test 3 execution time: 261501  <-- blockread 2
test 4 execution time: 2640901 <-- stringlist

Done.
Press <enter> to exit
--------------------------------------------------------
Celeron 400, Windows 2000

Fastest method seems to be, as predicted, BlockRead. However I thought Test3 would
have been faster.

Download at:
http://z505.com/download/pascal/StrWrap1/StrLoadFile_CpuWar.zip


Note: I sent a 33kb attachment to the mailing list, but message didn't appear to go
through. This email has been resent without the attachment.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: [CPU war] Speed question for strings

Marco van de Voort
> Which is faster, reading a file Character by Character, by Memory Block, or by
> StringList.text?

For the first test (char by char), have a look at settextbuf procedure.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal