Skip to content

perf(base): use queueMicrotask instead of rAF in scheduleRenderTask#13650

Open
pskelin wants to merge 1 commit into
mainfrom
perf/microtask-render-task
Open

perf(base): use queueMicrotask instead of rAF in scheduleRenderTask#13650
pskelin wants to merge 1 commit into
mainfrom
perf/microtask-render-task

Conversation

@pskelin
Copy link
Copy Markdown
Contributor

@pskelin pskelin commented Jun 5, 2026

Headless Cypress browsers throttle requestAnimationFrame, which can delay test execution. Switch the leading scheduler in scheduleRenderTask (Render.ts:77) from window.requestAnimationFrame to queueMicrotask to bypass the rAF throttle.

Goal of this PR: see if CI test durations actually shorten — that is the open question from #13642.

Context

Follow-up on #13642 (comment) — the previous attempt (lowering the 200ms mutation-observer settle to 0ms) showed no measurable speedup because that timer is gated behind renderFinished() and re-armed per quiet period, not paid per render. The leading rAF was called out there as a better target.

Risk

  • Microtasks run within the same task as the caller, so render now happens before the next paint. Tests/code that implicitly relied on a paint between mutation and render may behave differently.
  • whenDOMUpdated() (Render.ts:114) still uses rAF — left untouched here to keep the diff minimal and isolate the signal.

Headless Cypress browsers throttle requestAnimationFrame, which can
delay test execution. Switch the leading scheduler in
scheduleRenderTask to queueMicrotask to avoid the rAF throttle and
see if it gives a measurable speedup in CI test runs.

Refs: #13642 (comment)
@pskelin pskelin temporarily deployed to netlify-preview June 5, 2026 07:53 — with GitHub Actions Inactive
@sap-ui5-webcomponents-release
Copy link
Copy Markdown

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