draw2d icon indicating copy to clipboard operation
draw2d copied to clipboard

Performance in Reader.js/add

Open dawmster opened this issue 6 years ago • 6 comments

Hi. First I'd like to thank you for your great work. Your library is the best IMO from functional POV.

I hit however wall with loading drawing via json/Reader.js It takes 30 sec to load a meaningfully complicated drawing.

Profiler complains about node.getBBox() forcing reflow.

I profiled it in Chrome and 99% most of the time is spent in canvas.add (line 105 in json/Reader.js in my version - 101)

I tried throwing fastdom.mutate/measure around and around whole unmarshal method to now avail.

So I come here begging for help :)

Cheers Nick

dawmster avatar Nov 08 '18 10:11 dawmster

I'm trying to draw a scheme for my research project, which has 500 elements. Drawing itself takes more than 5 minutes. I wanted to ask your advice what can be done to speed up the rendering. Thank.

themrxcm avatar Dec 07 '18 11:12 themrxcm

Hello, same probleme, is there a way to commit during all the multiple add , i got like 1200 element to draw.

BernierArthur avatar Apr 10 '19 13:04 BernierArthur

Same problem, also when I drag a big node with more than 20 child nodes, drag is not smoth but just shows the last state where drag ended. What's the root cause? can we remove some unnecessary listners that may help?

mzohaibqc avatar May 29 '19 22:05 mzohaibqc

same here

ganbayar13 avatar Jan 19 '20 14:01 ganbayar13

Any progress for this?

marvz73 avatar May 06 '20 11:05 marvz73

i don't know if this can help, but i noticed this piece of code in cavas.js:

https://github.com/freegroup/draw2d/blob/5b1b8201ca535bca4365fe4dd8cbd7dd804d4515/src/Canvas.js#L921-L930

For each connection in json, all lines are repainted (every time), so the more connections in json the more time it will take. Using draw2d.Connection and SplineConnectionRouter as router, I would have expected it not to be executed. Maybe this can be changed with a check on router actually used.

The same thing happens here (but once):

https://github.com/freegroup/draw2d/blob/master/src/io/json/Reader.js#L126-L133

davec82 avatar Feb 01 '21 11:02 davec82