optimizing morphs

Ned Konz ned at bike-nomad.com
Mon Jan 27 18:36:52 UTC 2003

On Monday 27 January 2003 09:18 am, Ross Boylan wrote:
> I just noticed that I can consume about all my CPU just by hovering
> the mouse over an empty area of a spreadsheet-like widget I've
> made. Does anyone have any advice about how to improve this
> situation other than "don't do that"? :)
> The significant points, I think, are that I have a TwoWayScrollPane
> with MyGrid morph inside it.  MyGrid in turn contains 1234 morphs.
> I should mention it's not perfectly regular, but it does have rows.
> When I time the activity, a lot is going into
> MorphicEventDispatcher>>dispatchDefault:with:.  Under that a
> significant amount of time goes into some transformation methods; I
> think that's because I'm in a ScrollPane.
> When I hover over one of the 1234 morphs, I don't use much CPU;
> it's just when I'm outside this happens.
> It seems the problem is both that there are a lot of morphs on the
> list, and that the result of the first search is not cached, so it
> keeps looking.
> One route would be to make RowMorphs; this would reduce the search
> list by a factor of 10.

Or change the event dispatcher for your scroll pane. If there's some 
way to know that your mouse isn't over a submorph, then you can be 
more efficient.

Ned Konz

More information about the Squeak-dev mailing list