Hi Simon,
Edges are quite slow to draw. I introduced a new method that
exemplifies such a situation. Just execute: MessageTally spyOn:
MOBenchmarks new edges
This method render 1000 times 30*30 edges.
You will see that 96% is spent in MOStraightLineShape>>display:on:
Within this 96%:
- about 37% in MOEdge(MOFigure)>>display:on: (26% in
BalloonCanvas(FormCanvas)>>translateBy:during:)
- about 33% in BalloonCanvas>>drawPath:borderWidth:borderColor:
- about 10% in MONode(MOFigure)>>bounds
There are rooms for improvement here. An obvious one is to replace
IdentityDictionary by RBIdentityDictionary. I just did this in the
last version of Mondrian, and I gained 26% of gain.
Apparently, the bounds is computed twice. This could probably be
optimized as well.
Je pense avoir
trouvé une des raisons pour laquelle le dessin des
edge est si lent. Dans le code actual des displayOn:.... la
position des edge est recalculée à chaque fois. Le bounds des
element source/target est utilisé dans le calcul, mais le bounds du
edge lui-même n'est jamais initialisé et pas exploitable.
Exemple pour StraightLineShape
display: anElement on: aCanvas
|bounds|
bounds := anElement boundsOf: self.
aCanvas
drawPath: (Array
with: (bounds origin)
with: (bounds corner))
borderWidth: (self widthFor: anElement)
borderColor: (self colorFor: anElement).
next display: anElement on: aCanvas
Ca marche sauf si les node sont draggable, dans ce cas les bounds
des edges ne sont pas mis a jour par le drag. C'est pas très clair
comment propager un événement Node sur les Edge connectés pour
l'instant
A MOGraphElement has a variable edges. I do not think this variable is
used at all. Maybe you could rename this variable edges -> cacheEdges
and use this variables to store outgoing edges.
I would like to enforce the fact that a variable is a cache. This is
an important information. It is often hard to distinguish variables
that are conceptually relevant, and the ones that are use to caches
values.
Thanks for your effort.
Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.