FileTest Comparisons

Andreas Raab andreas.raab at gmx.de
Tue Feb 18 21:09:09 UTC 2003


Jimmie,

I'm very interested in these results, in particular the difference between
the "regular" and async files on Windows. That seems *very* surprising to
me... do you have any chance to measure where exactly the difference comes
from (e.g., is it in opening, writing, or closing)?! The reason I'm
wondering is that as far as the code is concerned there should be no
difference whatsoever between the two. If there is, then I'm making some
*rather* big mistake somewhere deep down below.

Cheers,
  - Andreas

> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org 
> [mailto:squeak-dev-bounces at lists.squeakfoundation.org] On 
> Behalf Of Jimmie Houchin
> Sent: Tuesday, February 18, 2003 9:07 PM
> To: The general-purpose Squeak developers list
> Subject: FileTest Comparisons
> 
> 
> Before writing for help regarding Socket serving I wrote some 
> tests to 
> check Squeak performance when simply streaming to files 
> instead of sockets.
> 
> Then I compared with similar Python code.
> 
> Below are the results and code.
> 
> Both Squeak and Python are slower on my WinXP machine.
> The WinXP machine is technically almost 3X as fast as my 
> Debian machine.
> I wish I had Linux installed on that machine to test. Maybe soon.
> 
> The Squeak code on the Windows machine is very slow. (with FileStream)
> I attempted AsyncFile to try to speed things up and it did 
> quite a bit 
> on Windows and some on Linux. But it failed to write out its 
> buffer to 
> all (missed about 20%) the 1000 files. It created all the files, just 
> didn't fill them.
> 
> Is the AsyncFile code going to be about the fastest way to do 
> something 
> like this? I don't even know if I am quite using the 
> AsyncFile properly.
> 
> Suggestions, reasons, comments welcome.
> 
> Jimmie Houchin
> 
> 
> Windows XP Home  (Athlon XP 2000) results:
> Squeak Results with FileStream: (ms) 17208  17441  17197
> Squeak Results with AsyncFile: (ms)   1018    966   1050
> Python Results: (seconds)             .718   .781   .922
> 
> Debian Linux  (700mhz Athlon) results:
> Squeak Results with FileStream:  749   579   679
> Squeak Results with AsyncFile:   550   244   431
> Python Results: (seconds)       .445  .432
> 
> 
> Squeak Code
> | string filedir |
> string := 'Hello World!'.
> filedir := FileDirectory default fullName, '\testfiles\'.
> 
> Transcript show: [1 to: 1000 do: [:index |
> 	fname := FileStream newFileNamed: filedir, index asString.
> 	fname nextPutAll: string.
> 	fname flush.
> 	fname close.]] timeToRun.
> 
> | string2 filedir2 |
> string2 := 'Hello World!'.
> filedir2 := FileDirectory default fullName, '\testfiles\'.
> 
> Transcript show: [1 to: 1000 do: [:index |
> 	fname := AsyncFile new.
> 	fname open: filedir2, index asString forWrite: true.
> 	fname writeBuffer: string2 atFilePosition: 0 onCompletionDo:[].
> 	fname close.]] timeToRun.
> 
> 
> 
> Python Code:
> fileTest.py
> import os, time
> 
> fdir = os.getcwd() + '/testfiles/'
> fstring = 'Hello World!'
> 
> 
> def test(rnumber):
>      t1 = time.time()
>      r = range(rnumber)
>      for x in r:
>          fname = open(fdir+`x`,'w')
>          fname.write(fstring)
>          fname.flush()
>          fname.close()
>      t2 = time.time()
>      print t2 - t1
> 
> 
> 
> 
> 
> 
> 
> 



More information about the Squeak-dev mailing list