3 ms·
We defer DOM manipulations to the end of each "run loop" where we coalesce them, removing redundant operations That's very interesting. Can you give examples o
by gruseom 18y ago
We defer DOM manipulations to the end of each "run loop" where we coalesce them, removing redundant operations
That's very interesting. Can you give examples of redundant operations that you coalesce?
I'm wondering if this approach might help in my case. I'm frequently repositioning/resizing thousands of little divs. Any suggestions?
- tlrobinson 18y agoI'm not the expert on this among us, but from what I understand there are situations where changing one thing causes something else to change and so forth. The specific operations we coalesce are appending nodes, removing nodes, setting the position and setting the size. Are you changing the position of the divs multiple times per "event" (i.e. mouse/keyboard event, etc) or just very frequently on separate events? No idea how well this would work, but maybe you could have a timeout fire N times per second (5, 10, 15, 30?) and update the DOM positions then? Though with thousands of divs I don't know if that will help. What are all these divs? Are they simple enough they could be drawn with Canvas?
- gruseom 18y agoAre you changing the position of the divs multiple times per "event" (i.e. mouse/keyboard event, etc) or just very frequently on separate events? Very frequently on separate events. What are all these divs? The cells of a spreadsheet. (The pos/size resets happen as the user scrolls or does something resizey. Oh, and the content of the divs changes under these conditions too.) Are they simple enough they could be drawn with Canvas? They're about as simple as you could get (at least before you add in formatting and all that). I never considered Canvas as an option - do you recommend trying it? We might not need to do anything, since the deterioration in FF3 is already getting better with the next release of FF (Shiretoko), though not as good as FF2. On the other hand, performance of this particular UI is critical to its user-acceptance, and if there's something we can do to get significant improvement I'd probably go for it.