Where does the time go?

Ross Boylan RossBoylan at stanfordalumni.org
Sun Jul 14 23:59:02 UTC 2002


Certain operations in my application have become painfully slow (100
seconds).  I put a profiler on them, but I'm not sure what to make of
the results, and would like some advice about what is going on and
what to do.

At the bottom of the Time Profile under **Leaves** 
53% WeakKeyAssociation>>key
23% WeakIdentityKeyDictionary>>scanFor:

First, I'm not completely clear on the relation between the times
under **Leaves** and the times reported above.

It looks as if at least some of the time in key is from SystemWindow
doing myDependents.  The application makes liberal use of a mix of the
update/changed dependency mechanism and the newer events mechanism.
It has many morphs, only a few of which use live stepping.  Lots of
stuff is in scrollpanes, and there are quite a few windows hidden
behind other windows.  There are many non-graphical objects too.

Part of the update removes all the morphs in a pane and then
repopulates it.  The time profile does not show any time in the
removal (which seems a bit odd).

27% of the time is within Browser>>setIn:  I have about 5
SystemBrowser windows up (not sure if that's the Browser here).
Virtually all this time is in WeakIdentityDictionary>>scanFor: (with
the myDependents on a SystemWindow in the middle).

Most of the rest of the time goes to creating new morphs.  Within
that, 32% (of the total time, not just the creating new morphs time)
is in addDepedent, specifically the myDependents calculation (which
seems to be largely the WeakKeyAssociation>>key call).

Tenative theory: if I made my classes hang onto their dependents,
instead of fishing them out of system-wide dictionaries, life would be
smoother.  Since I'm using two types of dependency mechanisms, and
since some of the offenders are subclasses of Morph, simply
subclassing Model or EventModel may not suffice.  Also, if some of the
problem is with existing classes (e.g., SystemWindow) it might be a
little tougher to do the surgery.


Object has
DependentsFields size = 9,043; 
EventsFields size = 1,880.
After global garbage collect and closing my profiles and a window with
many objects:  Dependents = 457; Events = 794.



More information about the Squeak-dev mailing list