[squeak-dev] The Trunk: Morphic-mt.1124.mcz
Levente Uzonyi
leves at caesar.elte.hu
Fri Apr 29 16:46:02 UTC 2016
On Fri, 29 Apr 2016, commits at source.squeak.org wrote:
> Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-mt.1124.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-mt.1124
> Author: mt
> Time: 29 April 2016, 1:04:05.656719 pm
> UUID: 20b80e2e-df90-fa43-bf17-339878efb46a
> Ancestors: Morphic-cmm.1123
>
> Speeds up drawing of large tree morphs by introducing a cache for the width of each column. Invalidate that cache each time the nodes in the tree are re-layouted.
>
> Try out "CompiledMethod allInstances explore" before and after this change. Have "PluggableListMorph highlightHoveredRow: true".
>
> Why? Computation of largest item in a column is O(n) at the moment. Drawing code needs width of column to position the strings in each row. Each row is a (string) morph and the columns are "faked".
>
> =============== Diff against Morphic-cmm.1123 ===============
>
> Item was changed:
> ----- Method: IndentingListItemMorph>>widthOfColumn: (in category 'accessing - columns') -----
> widthOfColumn: columnIndex
> | widthOrSpec |
> container columns ifNil: [ ^ self width ].
> + (container columnsCache at: columnIndex)
> + ifNotNil: [ :cachedWidth | ^ cachedWidth ].
> widthOrSpec := container columns at: columnIndex.
> + container columnsCache at: columnIndex put: (widthOrSpec isNumber
> - ^ widthOrSpec isNumber
> ifTrue: [ widthOrSpec ]
> ifFalse:
> [ widthOrSpec isBlock
> ifTrue:
> [ widthOrSpec
> cull: container
> cull: self ]
> ifFalse:
> [ widthOrSpec
> ifNil: [ self width ]
> ifNotNil: [ "Fall back"
> + 50 ] ] ]).
> + ^ container columnsCache at: columnIndex!
Why do a lookup when the previous expression returns the same value?
Levente
More information about the Squeak-dev
mailing list
|