Stop forcing layout and style recalculation while drawing frames
- github
- github/openchronology/timeline-app
- commit
- main
- github/athanclark
Profiling wheel zooming at 4,000 moments: half the time went to width(), which read stage.clientWidth, once per marker through viewContext(), and every read after the frame's DOM changes made the browser lay the page out again. A fifth went to getAnimations() and getComputedStyle() on labels, each recomputing every style. The stage's size is now kept by a ResizeObserver, and the animations started on labels are tracked rather than queried. On a slow VM, navigation got 2.5-5x faster: at 4,000 moments wheel zoom went from 1,092 to 245 ms, a drag's longest frame from 800 to 217 ms and a pinch's from 1,183 to 250 ms (#68). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011fFY8eruEi1xAkkMBni13B https://github.com/openchronology/timeline-app/commit/fa332ab51bfa107d5397cb30b46010aa831eb66e
Related
Open Stop forcing layout and style recalculation while drawing frames in the timeline