File Performance Q.?

Bob Arning arning at charm.net
Fri May 10 20:32:11 UTC 2002


On Fri, 10 May 2002 15:07:00 -0500 Jimmie Houchin <jhouchin at texoma.net> wrote:
>I was naively expecting Squeak to be faster but was very surprised.
>Python's results are in seconds and Squeak's in milliseconds.
>
>Am I doing something wrong in the Squeak code to cause it to be up to 
>100 times slower? Or is this a case of the best tool for the job?
>
>Any help or comments appreciated.

Jimmie,

The first general suggestion in cases like this is to run a MessageTally to see what the code is doing. It may be real obvious what you need to look at. Having encountered problems like this before, one thing that I know mat be slow is going to the OS for each and every character in the file. If you read file1 in its entirety:

	file1 open: 'mImac:squeak:DSqueak2.9:dis33.changes' forWrite: false.
	file1 _ ReadStream on: file1 contentsOfEntireFile.

and eliminate the "file1 close", this reduces the time needed to read a 16.7 meg changes file from 145 seconds to 22 seconds. You might save more if you did not really need a CrLfFileStream and could just use a regular stream.

Cheers,
Bob



More information about the Squeak-dev mailing list