[BUG] Abysmal performance in FileList

Ned Konz ned at bike-nomad.com
Thu Mar 7 06:23:30 UTC 2002


On Wednesday 06 March 2002 09:40 pm, Dan Ingalls wrote:
> Having fixed things so they don't crash when viewing short files, there is
> now a huge performance bug (can take over a second to click on an empty
> file) in the fileList due to its incredibly smarts.
>
> Here's the stack that ends up doing full garbage collects which, it can be
> argued, is not incredibly smart here.
>
> 	- Dan
> -----------------------------
>
> 	      |  |                      67.2% {11911ms} FileList>>fileListIndex:
>       |  |
>       |  |                        66.3% {11751ms} FileList>>updateButtonRow
>
> [66.2% {11733ms} FileList>>dynamicButtonServices
> [  66.2% {11733ms} FileList>>itemsForFile:
> [    66.2% {11733ms} ArchiveViewer class>>fileReaderServicesForFile:suffix:
> [      66.2% {11733ms} ZipArchive class>>isZipArchive:
> [        66.2% {11733ms} StandardFileStream class>>oldFileNamed:
> [          66.1% {11716ms} StandardFileStream>>open:forWrite:
> [            66.0% {11698ms} StandardFileStream
> class>>retryWithGC:until:forFileNamed:

We can turn off the reading of the file (and only look if the suffixes match 
some more limited list (.zip, .pr, .exe ??)

What I added there (and what is apparently causing delays) is a test for 
zip-ness that reads backwards through the file. This is because some 
self-extracting archives don't start with a recognizable zip signature.

The problem is apparently that opening files on your platform takes a long 
time (why is a GC being done there if you're not out of handles? hmm...). On 
my machine it was fast so I didn't worry about it:

Time millisecondsToRun: [ ZipArchive isZipArchive: 
'/home/ned/Squeak/3.3/emptyFile' ]  -> 2

Time millisecondsToRun: [ ZipArchive isZipArchive: 
'/home/ned/Squeak/3.3/Squeak3.3a-4771.changes' ]  -> 141

The latter file is about 12 MB. The looking for a signature at the end of a 
file goes through 40K of the end of the file.

The attached change set suppresses this scan for most files, only 
scanning when the file suffix is .zip, .pr, or .exe (which should get most of 
the archives).

Sorry to have caused delays...

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DumberZipsInFileList-nk.1.cs
Type: text/x-c++
Size: 771 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20020306/93a8cf23/DumberZipsInFileList-nk.1.bin


More information about the Squeak-dev mailing list