Morphic slowness (was Re: Does *anyone* use MVC?)

Ned Konz ned at bike-nomad.com
Thu Aug 1 22:44:37 UTC 2002


On Thursday 01 August 2002 02:35 pm, Andreas Raab wrote:
> Well, then let's get started. You say that opening menus hurts?! So
> how about (from a workspace):

Here's what I tried on my WinCE machine (131MHz MIPS).

It takes 4.2 seconds to open the World Menu
(and about 1 second to see characters that I type into a Workspace!).

If I move the menu around, it jerks from place to place at about
4 updates per second.

(It takes 70msec to open the World menu on my 1200MHz Duron).

It takes (with the same VM) 2.3 seconds to open the World menu
in the Dynapad image (which is a 2.8/2359 image). Character delays
when typing into a Workspace are almost unnoticeable under 2.8.

Dragging the World menu around, I see updates happening maybe
10 times per second.

In 3.2, I did this:

MessageTally spyOn: [ World putUpWorldMenu: ActiveEvent ]

From this, I see a few things that are really slow:

1.9 seconds is spent doing layout with a TableLayout
(which is probably overkill for a MenuMorph anyway).
(I suspect that the layout is happening each time that a menu item
is being added).

0.5 seconds is spent setting up BalloonTexts, most of this in
truncating Strings (!)

0.5 seconds is spent on getting the pushpin image for the
titlebar. I need to cache that...

And, though I don't see where it's happening,

1.3 seconds is spent looking through IdentityDictionaries.
Presumably this is looking for Morph properties and preferences.

So what would you attack first?

I'd first see if I couldn't dispense with the TableLayout in the MenuMorphs.

I'd also cache the pushpin image, and maybe add a preference for simpler
menu titlebars.

I'd look into where all the property scanning is going on, and see if I couldn't
reduce it.

Maybe we need to add another instance variable or two to the MorphExtensions.

 - 154 tallies, 4262 msec.

**Tree**
96.8% {4126ms} PasteUpMorph>>putUpWorldMenu:
  |53.9% {2297ms} MenuMorph>>popUpEvent:in:
  |  |53.9% {2297ms} MenuMorph>>popUpAt:forHand:in:
  |  |  53.9% {2297ms} MenuMorph>>popUpAt:forHand:in:allowKeyboard:
  |  |    46.8% {1995ms} PasteUpMorph>>addMorphFront:
  |  |      |46.8% {1995ms} PasteUpMorph(Morph)>>addMorphInFrontOfLayer:
  |  |      |  46.8% {1995ms} PasteUpMorph(Morph)>>addMorph:inFrontOf:
  |  |      |    46.8% {1995ms} PasteUpMorph(Morph)>>privateAddMorph:atIndex:
  |  |      |      44.8% {1909ms} PasteUpMorph(Morph)>>addedOrRemovedSubmorph:
  |  |      |        44.8% {1909ms} MenuMorph(Morph)>>fullBounds
  |  |      |          44.8% {1909ms} MenuMorph(Morph)>>doLayoutIn:
  |  |      |            41.6% {1773ms} TableLayout>>layout:in:
  |  |      |              |41.6% {1773ms} TableLayout>>layoutTopToBottom:in:
  |  |      |              |  31.8% {1355ms} AlignmentMorph(Morph)>>layoutInBounds:
  |  |      |              |    |21.4% {912ms} MenuItemMorph(Morph)>>bounds:
  |  |      |              |    |  |13.0% {554ms} MenuItemMorph(Morph)>>position:
  |  |      |              |    |  |  |9.1% {388ms} MenuItemMorph(Morph)>>invalidRect:
[9.1% {388ms} MenuItemMorph(Morph)>>invalidRect:from:
[  7.8% {332ms} MenuMorph(Morph)>>invalidRect:from:
[    7.1% {303ms} PasteUpMorph>>invalidRect:from:
[      6.5% {277ms} WorldState>>recordDamagedRect:
[        6.5% {277ms} DamageRecorder>>recordInvalidRect:
[          5.8% {247ms} Rectangle>>intersect:
[            5.8% {247ms} Rectangle class>>origin:corner:
  |  |      |              |    |  |  |3.9% {166ms} MenuItemMorph(Morph)>>privateFullMoveBy:
[2.6% {111ms} MenuItemMorph(Morph)>>privateMoveBy:
  |  |      |              |    |  |8.4% {358ms} MenuItemMorph(Morph)>>extent:
  |  |      |              |    |  |  8.4% {358ms} MenuItemMorph(Morph)>>changed
[7.1% {303ms} MenuItemMorph(Morph)>>invalidRect:
[  7.1% {303ms} MenuItemMorph(Morph)>>invalidRect:from:
[    7.1% {303ms} MenuMorph(Morph)>>invalidRect:from:
[      4.5% {192ms} PasteUpMorph>>invalidRect:from:
[        4.5% {192ms} WorldState>>recordDamagedRect:
[          4.5% {192ms} DamageRecorder>>recordInvalidRect:
[            3.9% {166ms} Rectangle>>intersect:
[              3.9% {166ms} Rectangle class>>origin:corner:
  |  |      |              |    |5.2% {222ms} AlignmentMorph(Morph)>>doLayoutIn:
  |  |      |              |    |  2.6% {111ms} TableLayout>>layout:in:
  |  |      |              |    |    2.6% {111ms} TableLayout>>layoutLeftToRight:in:
[2.6% {111ms} AlignmentMorph(Morph)>>layoutInBounds:
  |  |      |              |  7.8% {332ms} AlignmentMorph(Morph)>>minExtent
  |  |      |              |    3.9% {166ms} MenuItemMorph(StringMorph)>>fullBounds
  |  |      |              |      3.9% {166ms} MenuItemMorph(Morph)>>fullBounds
  |  |      |              |        3.9% {166ms} MenuItemMorph(Morph)>>doLayoutIn:
[3.9% {166ms} MenuItemMorph(Morph)>>outerBounds
  |  |      |            3.2% {136ms} MenuMorph(Morph)>>adjustLayoutBounds
  |  |      |              2.6% {111ms} MenuMorph(Morph)>>submorphBounds
  |  |      |                2.6% {111ms} MenuItemMorph(StringMorph)>>fullBounds
  |  |      |                  2.6% {111ms} MenuItemMorph(Morph)>>fullBounds
  |  |    4.5% {192ms} MenuMorph>>positionAt:relativeTo:inWorld:
  |  |      4.5% {192ms} MenuMorph(Morph)>>position:
  |  |        3.2% {136ms} MenuMorph(Morph)>>privateFullMoveBy:
  |  |          3.2% {136ms} MenuLineMorph(Morph)>>privateFullMoveBy:
  |  |            3.2% {136ms} MenuLineMorph(Morph)>>privateMoveBy:
  |22.7% {967ms} PasteUpMorph>>buildWorldMenu:
  |  |22.7% {967ms} TheWorldMenu>>buildWorldMenu
  |  |  21.4% {912ms} TheWorldMenu>>fillIn:from:
  |  |    11.7% {499ms} MenuMorph>>balloonTextForLastItem:
  |  |      |11.7% {499ms} MenuItemMorph(Morph)>>setBalloonText:
  |  |      |  10.4% {443ms} MenuItemMorph(Morph)>>setBalloonText:maxLineLength:
  |  |      |    10.4% {443ms} String>>withNoLineLongerThan:
  |  |      |      3.2% {136ms} String(SequenceableCollection)>>,
  |  |      |        |2.6% {111ms} String(SequenceableCollection)>>copyReplaceFrom:to:with:
  |  |      |      2.6% {111ms} String>>withBlanksTrimmed
  |  |    8.4% {358ms} MenuMorph>>add:target:selector:argumentList:
  |  |      5.2% {222ms} MenuItemMorph class(Morph class)>>new
  |  |        5.2% {222ms} MenuItemMorph>>initialize
  |  |          4.5% {192ms} MenuItemMorph(Morph)>>hResizing:
  |  |            4.5% {192ms} MenuItemMorph(Morph)>>assureLayoutProperties
  |  |              4.5% {192ms} MenuItemMorph(Morph)>>layoutProperties:
  |  |                3.9% {166ms} MorphExtension>>layoutProperties:
  |  |                  3.9% {166ms} MorphExtension>>setProperty:toValue:
  |  |                    3.2% {136ms} IdentityDictionary(Dictionary)>>at:put:
  |18.8% {801ms} MenuMorph>>addTitle:
  |  18.8% {801ms} MenuMorph>>addTitle:updatingSelector:updateTarget:
  |    17.5% {746ms} MenuMorph>>addStayUpIcons
  |      11.7% {499ms} MenuMorph class>>pushPinImage
  |        11.7% {499ms} ColorForm>>colorsFromArray:
  |          11.7% {499ms} Color class>>fromArray:
  |            9.1% {388ms} Color class>>r:g:b:
  |              |6.5% {277ms} Color>>setRed:green:blue:
  |              |  |6.5% {277ms} Float>>rounded
  |              |2.6% {111ms} primitives
  |            2.6% {111ms} primitives
3.2% {136ms} MessageTally class>>spyOn:toFileNamed:
  3.2% {136ms} MessageTally>>spyEvery:on:
    3.2% {136ms} SmallInteger>>-
      3.2% {136ms} SmallInteger(Integer)>>-
        3.2% {136ms} Array(Object)>>adaptToInteger:andSend:
          3.2% {136ms} Array(Collection)>>adaptToNumber:andSend:

**Leaves**
31.8% {1355ms} IdentityDictionary>>scanFor:
16.9% {720ms} Rectangle class>>origin:corner:
6.5% {277ms} Float>>rounded
4.5% {192ms} Point>>+
3.9% {166ms} Array(SequenceableCollection)>>copyReplaceFrom:to:with:
3.2% {136ms} Color class>>r:g:b:
3.2% {136ms} String(SequenceableCollection)>>copyFrom:to:
3.2% {136ms} Array(Collection)>>adaptToNumber:andSend:
2.6% {111ms} Color class>>fromArray:
2.6% {111ms} MethodDictionary>>includesKey:

**Memory**
	old			+57,416 bytes
	young		-151,120 bytes
	used		-93,704 bytes
	free		+93,704 bytes

**GCs**
	full			0 totalling 0ms (0.0% uptime)
	incr		9 totalling 187ms (4.0% uptime), avg 21.0ms
	tenures		1 (avg 9 GCs/tenure)
	root table	0 overflows

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE




More information about the Squeak-dev mailing list