Skip to content

test: reduce mutation observer delay from 200ms to 0ms#13642

Closed
pskelin wants to merge 1 commit into
mainfrom
test-render-mutation-observer-0ms
Closed

test: reduce mutation observer delay from 200ms to 0ms#13642
pskelin wants to merge 1 commit into
mainfrom
test-render-mutation-observer-0ms

Conversation

@pskelin
Copy link
Copy Markdown
Contributor

@pskelin pskelin commented Jun 4, 2026

Purpose

Experimental PR to measure the impact of the mutation observer delay on CI test execution speed.

Change

In packages/base/src/Render.ts, the mutation observer timer in scheduleRenderTask currently waits 200ms before resolving the render task promise. This PR reduces that delay to 0ms to evaluate whether tests run faster on CI.

-					}, 200);
+					}, 0);

Note

Not intended for merge — purely a benchmark to compare CI run duration against the baseline.

Experimental change to measure CI test execution speed impact.

In Render.ts, the mutation observer timer waits 200ms before resolving
the render task promise. This commit reduces it to 0ms to evaluate
whether tests run faster on CI.
@pskelin pskelin temporarily deployed to netlify-preview June 4, 2026 11:37 — with GitHub Actions Inactive
@sap-ui5-webcomponents-release
Copy link
Copy Markdown

@pskelin
Copy link
Copy Markdown
Contributor Author

pskelin commented Jun 4, 2026

Finding: no measurable speedup

Compared the Test step durations on the same passing jobs in this PR (0ms) vs baseline run #26949481414 on main (8247700b, 200ms):

Job PR #13642 (0ms) main baseline Δ
check (base) 77s 78s −1s
check (compat) 39s 43s −4s
check (fiori) 196s 181s +15s
check (main:cy:suite-1) 238s 224s +14s
check (main:cy:suite-3) 223s 252s −29s

Total across these five passing jobs: 773s (PR) vs 778s (main) — a 5-second / ~0.6% delta scattered in both directions, well within run-to-run noise.

Why the 200ms doesn't actually cost 200ms per test

The mutation-observer timer in Render.ts:90-95 only gates whenDOMUpdated() / renderFinished(). It fires once at the end of an update batch, not after every DOM write. And:

  1. Tests that don't await renderFinished() (most Cypress assertions go through cy.get(...).should(...) retry loops) never wait on it at all.
  2. Even tests that do await it get the timer re-armed on every new mutation — the 200ms delay is only paid once per quiet period, not per assertion.

So the 200ms is a "settle" guard, not a per-render wait. Closing this — the speedup hypothesis didn't hold.

Better targets if chasing test-speed wins

  • The leading requestAnimationFrame in scheduleRenderTask (Render.ts:77) — headless Cypress browsers throttle rAF.
  • The second rAF inside whenDOMUpdated (Render.ts:114).
  • Per-test cy.wait(...) calls and explicit setTimeout polls in spec files.

@pskelin
Copy link
Copy Markdown
Contributor Author

pskelin commented Jun 4, 2026

Closing — see comment above for the finding. The 200ms mutation-observer delay isn't a meaningful contributor to test duration.

@pskelin pskelin closed this Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant