phetsims / scenery

Scenery is an HTML5 scene graph.
http://scenerystack.org/
MIT License
56 stars 12 forks source link

Performance improvements for the PDOM #1163

Open zepumph opened 3 years ago

zepumph commented 3 years ago

Over in https://github.com/phetsims/ratio-and-proportion/issues/356, @jessegreenberg and I found a couple of places where we could improve scenery's performance as it pertains to the PDOM. Mostly this has to do with the frequency and quality of HTMLElement manipulation. Here is the list we came up to try out and see if performance improves. I was also thinking that potentially we could make some examples, perhaps with animation (outfit blast/?) to expose some performance-constrained cases.

We did not feel like this work blocked Ratio and Proportion RC, but it should have some time spent on it soon. At least for the low hanging fruit.

zepumph commented 2 years ago

I see about 1000 calls to setting textContent on a dom element when spamming the RAP hand up and down. I believe that is a synchronous step to update attributes. I know we don't want to kick off a total rebuild during next update display, but perhaps we could still only update attributes/generally mutate the peer on update. This will likely involve creating "dirty" flags, but could be reasonably possible/simple