Status: New Owner: ---- Labels: Type-Defect Priority-Medium
New issue 901 by benjamin...@gmail.com: ROCachedLabel - improved performance with large numbers of elements http://code.google.com/p/moose-technology/issues/detail?id=901
With large numbers of elements that display strings, Roassal is quite slow. Tracing this down shows the main culprit is #extentFor:. A proposed solution ROCachedLabel is provided in attached .st file which returns a cached extentFor value. This is nilled out when the value of the string changes. The other variables in ROCachedLabel are also cached, but the performance gain from these is unclear.
To test the effect of this, try the following script for both ROLabel and ROCachedLabel... --- | rawView el count elements | rawView := ROView new @ RODraggable. count := 1000. elements := (1 to: count) collect: [ :x | el := (ROElement spriteOn: x) + ROLabel "ROCachedLabel". el on: ROMouseLeftClick do: [ :ev | ev element model: (ev element model + 1). ev element view signalUpdate . ] ]. rawView addAll: elements. 1 to: count do: [ :x | rawView add: (ROEdge new from: (elements at: x) to: (elements at: (Random new nextInt: count - x + 1))) + ROLine. ]. ROHorizontalTreeLayout on: rawView elements. rawView open ---
Also attached is the MessageTally report from which it was determined that #extentFor was the problem.
Attachments: ROCachedLabel.st 1.3 KB MessageTally-ROLabel.txt 38.8 KB