You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Perf] motion(): every update resolves each element's timing context with DOM queries and scans of all points #271
Under motion(), an update's cost grows faster than its element count. One keyed rect mark, only y values changing, median synchronous host.update in headless Chromium 153:
Bars
motion()
Static SVG renderer
100
3.5 ms
0.9 ms
200
7.6 ms
1.3 ms
400
19.4 ms
2.1 ms
800
60.7 ms
4.0 ms
Compiling the scene is about 1 ms at 800 bars. A CPU profile at 400 bars puts 68% of host.update inside elementTimingContext, 26% in motionPointForKey alone.
Why
addUpdateTrack resolves a timing context for every retained element (motion.ts:2198), and createPresentationTracks again for every point that moved (motion.ts:3368-3371). Each one starts from the leaf:
motionPointForKey walks every point of the scene and builds a string for each (motion.ts:3220-3236), then the points are filtered by markId only to count them (motion.ts:3093-3097);
a tick collects and filters every keyed element of its axes group to count its peers (motion.ts:3051-3056).
A mark with n elements does about n² string comparisons for each update.
Build a key-to-point map and a point count for each markId once for a scene, and find the owning group, role and peers on the way down the reconcile walk, not from each leaf.
Activity