Skip to content

Implement RFC #957: Render Aware Scheduler Interface - #21552

Draft
NullVoxPopuli wants to merge 1 commit into
mainfrom
nvp/scheduler-interface
Draft

Implement RFC #957: Render Aware Scheduler Interface#21552
NullVoxPopuli wants to merge 1 commit into
mainfrom
nvp/scheduler-interface

Conversation

@NullVoxPopuli

@NullVoxPopuli NullVoxPopuli commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Supersedes:

Implements (phase one of):

Why:

This part 1 is just the interface and is not hooked up to anything. Users of the interface would not be able to see any benefit if they implement a strategy.

Note

The scheduler is not a backburner replacement, it's a means to give consistent naming to platform concepts and their timing, so that when we deprecate rsvp, backburner, the runloop, etc, ember's renderer can use these platform concepts natively (abstraction-less)

This sort of work is a little large (and the RFC is not accepted), so I'm splitting the hook-in-to-existing-behavior to a separate PR here:

  • by default, there is actually nothing for ember to use

Adds the `@ember/scheduler` package proposed by RFC 0957:

- `render`, `layout`, `composite`, `next` and `idle` phase functions,
  each returning a promise that resolves according to the registered
  scheduling strategy
- `registerStrategy`, for providing the scheduling strategy when defining
  the Application
- `@ember/scheduler/strategy`, the default strategy implementation, which
  flushes the render/layout/composite phases in order via ordered
  requestAnimationFrame callbacks within a single frame, prior to paint

The deprecations of @ember/runloop and RSVP described by the RFC are left
to follow-up work; this is the additive API surface.

Fix Safari flake and idle() starvation in the default strategy

The "composite while composite is flushing" test asserted ordering across
two independent channels: a setTimeout task scheduled during frame 1
versus frame 2's requestAnimationFrame callbacks. The HTML spec does not
order pending timer tasks against the next rendering opportunity, and
Safari 15.6 runs the next frame's rAF callbacks first. The test now
anchors entirely to the rAF channel, using a raw requestAnimationFrame
registered ahead of the rescheduled phase windows as the frame-2
boundary.

idle() also armed requestIdleCallback without a timeout; fully-idle or
backgrounded pages can starve rIC indefinitely, leaving the promise
unresolvable. Cap the wait with { timeout: 500 }.
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

📊 Size report

Tarball size1.2 MB1.2 MB

dist/dev   0.6%↑

File Before (Size / Brotli) After (Size / Brotli)
./packages/@ember/scheduler/index.js 7.2 kB / 1.8 kB
./packages/@ember/scheduler/strategy.js 5.1 kB / 1.4 kB
./packages/shared-chunks/api-{hash}.js 26.2 kB / 5.8 kB -61.6%↓10 kB / -63.5%↓2.1 kB
./packages/shared-chunks/template-{hash}.js 491 B / 203 B 118%↑1.1 kB / 98%↑401 B
Total (Includes all files) 2 MB / 486.3 kB 0.6%↑2 MB / 0.7%↑489.6 kB

dist/prod   0.6%↑

File Before (Size / Brotli) After (Size / Brotli)
./packages/@ember/scheduler/index.js 6.3 kB / 1.6 kB
./packages/@ember/scheduler/strategy.js 5.1 kB / 1.4 kB
Total (Includes all files) 1.8 MB / 443.7 kB 0.6%↑1.9 MB / 0.7%↑446.8 kB

smoke-tests/v2-app-template/dist   No changes

File Before (Size / Brotli) After (Size / Brotli)
Total (Includes all files) 340.6 kB / 94.8 kB 340.6 kB / 94.8 kB

smoke-tests/v2-app-hello-world-template/dist   No changes

File Before (Size / Brotli) After (Size / Brotli)
Total (Includes all files) 132.4 kB / 37 kB 132.4 kB / 37 kB

🤖 This report was automatically generated by wyvox/pkg-size

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