-
Notifications
You must be signed in to change notification settings - Fork 14
Remove MutationObserver, overload setAttribute instead #34
Conversation
Blocked until I have a way to do better performance tests. |
Losing the ability to edit stuff from the DOM is a big deal IMO. Being able to show folks that are new to JS and HTML how to mess around with the devtools has been really powerful in getting them accustomed to the environment. Having to change source + reload all the time doesn't flow as nicely. If this gets changed, would it be possible to enable the old behavior behind a flag or API call? |
Yeah, I think I'd like to at least offer an |
* main: Refactor args parsing (fixes #40) Fix example v0.3.0-3 Resolve that circular dependency that rollup was complaining about Reference other objects via CSS selectors in attributes (closes #16) New camera handling BaseElement.applyAllAttributes <three-rect-area-light-helper> Make ThreeElement.object writable Have ThreeGame emit a "ready" event Ignore the src symlink "...deg" transforms (#33) (fixes #31)
* main: Change listing Actually mutate attributes Move requestFrame to BaseElement and bind it to this
I've done a bit of experimenting and light benchmarking and have some good data now. I've created a new example that spawns 100 meshes and animates them in every frame. I have deliberately chosen an approach where the Result: the For this reason, I will be merging this PR soon. This unfortunately means that we'll be losing the ability to have a user fiddle around in their devtools, play with attributes, and see the changes reflected in the scene immediately. A couple of thoughts:
If you have thoughts on this, please voice them! Update: just to give you an idea of how much better than using MutationObserver this is: if I bump the number of dodecahedrons in the swarm from 100 to 1000, a total of 4ms is spent in setAttribute per frame, vs. ~40ms in the microtasks queued by the MutationObserver. |
I have no idea why I didn't think of this sooner. Where's the catch?
Summary:
BaseElement
'ssetAttribute
methodPros:
Cons:
setAttribute
is not triggered when the user manually modifies an attribute value in the DOM.