StandardFileStream>>#open:forWrite:

Stefan Matthias Aust sma at 3plus4.de
Mon Jun 19 19:58:56 UTC 2000


Eric,

You might have already noticed that Squeak file i/o is much slower because 
everything is unbuffered.  So it's often much faster to do

s := (StandardFileStream fileNamed: 'abc') contentsOfEntireFile readStream

>Notice the first line, it does a GC if necessary.

The GC is done to force finalization of unclosed, but unreferenced file 
streams so that there's a higher chance that you don't get errors because a 
file is reported as missing or existing just because it hasn't flushed or 
unlocked yet.

However, I'd consider this problem as an error and would blaim the 
programmer for not using

[ ] ensure: [s close]

and remove that IMHO hack in exchange for the speed gain.

I reported the problems a few weeks ago while I was benchmarking the 
translation and generation of C files and Andreas said that he'd look into 
that issue.

bye
--
Stefan Matthias Aust  //  Bevor wir fallen, fallen wir lieber auf





More information about the Squeak-dev mailing list