On Fri, 29 Apr 2016, commits@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)
widthOrSpec := container columns at: columnIndex.ifNotNil: [ :cachedWidth | ^ cachedWidth ].
- 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
Hi Levente,
what do you refer to? The width for a column will be computed only once now and then accessed only.
Best, Marcel
-- View this message in context: http://forum.world.st/The-Trunk-Morphic-mt-1124-mcz-tp4892867p4892991.html Sent from the Squeak - Dev mailing list archive at Nabble.com.
2016-04-29 20:49 GMT+02:00 marcel.taeumel Marcel.Taeumel@hpi.de:
Hi Levente,
what do you refer to? The width for a column will be computed only once now and then accessed only.
Best, Marcel
Hi Marcel,
at:put: will answer the put object. So rather than self at: key put: value. ^self at: key you can ^self at: key put: value
-- View this message in context: http://forum.world.st/The-Trunk-Morphic-mt-1124-mcz-tp4892867p4892991.html Sent from the Squeak - Dev mailing list archive at Nabble.com.
Ah, of course. Thanks for the pointer.
Best, Marcel
-- View this message in context: http://forum.world.st/The-Trunk-Morphic-mt-1124-mcz-tp4892867p4893032.html Sent from the Squeak - Dev mailing list archive at Nabble.com.
squeak-dev@lists.squeakfoundation.org