RESOLVED FIXED320142
[MotionMark 1.3] Mutation frames for Leaves are very expensive
https://bugs.webkit.org/show_bug.cgi?id=320142
Summary [MotionMark 1.3] Mutation frames for Leaves are very expensive
Dan Glastonbury
Reported 2026-07-23 18:35:40 PDT
Mutation frames for this benchmark are disproportionately more expensive than animation frames. This causes our rAF cadence to stumble leading to noisy results. Investigate what can be done to improve mutation to reduce noise.
Attachments
Radar WebKit Bug Importer
Comment 1 2026-07-23 18:35:47 PDT
Dan Glastonbury
Comment 2 2026-07-23 18:40:54 PDT
Slow mutation frames lead to short animation frames as our rAF handling tries to realign to CADisplayLink firing. Here it is on a timeline, using the verified 22.52 → 10.82 pair (sum = 33.34 ≈ 2 × 16.67): ``` vsync grid: 0 16.67 33.34 50.0 | | | | callback A ---● start = 0 (on grid) callback B --------------------● start = 22.52 (LATE) callback C ---------------------------------● start = 33.34 (back on grid) ``` recorded frameLength(B) = B - A = 22.52 ← the "slow" sample recorded frameLength(C) = C - B = 10.82 ← the "short" sample 1. Frame A ran long (~22ms of mutation work), so it held the main thread past the 16.67ms tick. 2. The middle callback (B) starts late — it can't fire until A's rendering update lets go, so it lands at ~22.5ms instead of ~16.67ms. That late start is what gets recorded as the 22.5ms sample. 3. The third callback (C) re-syncs to the 60fps grid at 33.34ms (2 × 16.67). Because B started late at 22.5, C at 33.34 is only 10.8ms behind it — so C is recorded "early" relative to the late B, giving the short sample.
Dan Glastonbury
Comment 3 2026-07-23 18:44:32 PDT
Profiling shows a lot of time spent in the following calltree: ``` WebCore::jsElementPrototypeFunction_remove(JSC::JSGlobalObject*, JSC::CallFrame*) (in WebCore) WebCore::ContainerNode::removeChild(WebCore::Node&) (in WebCore) WebCore::RenderTreeUpdater::tearDownRenderers(WebCore::Element&, WebCore::RenderTreeUpdater::TeardownType) (in WebCore) void WebCore::RenderTreeUpdater::tearDownRenderersInternal<(WebCore::RenderTreeUpdater::TeardownScope)0>(WebCore::Element&, WebCore::RenderTreeUpdater::TeardownType, WebCore::RenderTreeBuilder&) (in WebCore) WebCore::RenderTreeBuilder::destroyAndCleanUpAnonymousWrappers(WebCore::RenderObject&, WebCore::RenderElement const*) (in WebCore) ```
Dan Glastonbury
Comment 4 2026-07-23 19:22:48 PDT
EWS
Comment 5 2026-07-28 17:22:46 PDT
Committed 318113@main (947e0ed57ed1): <https://commits.webkit.org/318113@main> Reviewed commits have been landed. Closing PR #70080 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.