[squeak-dev] Slow your image to a crawl with this one weird trick!

Chris Muller asqueaker at gmail.com
Thu Aug 29 01:50:45 UTC 2019


On Fri, Aug 23, 2019 at 6:23 AM Levente Uzonyi <leves at caesar.elte.hu> wrote:

> On Fri, 23 Aug 2019, Marcel Taeumel wrote:
>
> > Hmm... HierarchyBrowser has a cache in #classList. Browser has no such
> cache. Browser >> #hierarchicalClassList is slow.
> > Also, class compilation is so slow because of SmalltalkImage >>
> #logChange:.
>
> I'm not sure that's true. It seems to be more like a mismeasurement by the
> profiler. The following takes ~200ms on my machine (it should remove the
> spam from the changes file, but use at your own risk):
>
> | startPosition |
> startPosition := (SourceFiles at: 2) size.
> [ 10000 timesRepeat: [ Smalltalk logChange: 'test' ] ] timeProfile.
> (SourceFiles at: 2) truncate: startPosition.
>
> Also, #forceChangesToDisk's trick to force write-to-disk by closing and
> reopening the file won't work in modern OSes. They'll realize that you're
> reopening a file already in your process's cache, and will just provide
> you with the cached file without forcing the contents to be written to
> disk.
> We have #sync to actually force write-to-disk, but using that in
> #forceChangesToDisk will make the above snippet 250x slower (or more if
> your storage device is not that fast).
>
>
Magma handles a similar issue in its need to #sync by doing it no more than
every 5 seconds.

 - Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190828/b6912e23/attachment.html>


More information about the Squeak-dev mailing list