Skip to content

Implement customisation point for scheduled callback on isolated EL - #3679

Merged
glbrntt merged 1 commit into
apple:mainfrom
glbrntt:isolated-schedule-callback
Jul 23, 2026
Merged

glbrntt merged 1 commit into
apple:mainfrom
glbrntt:isolated-schedule-callback

Conversation

@glbrntt

@glbrntt glbrntt commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Motivation:

The schedule callback mechanism on EventLoop has an equivalent on an isolated EventLoop. The default isolated implementation puts the hander in a loop bound box and calls the non-isolated version.

This is okay but introduces a number of additional "in event loop" checks which are required for correctness in the general case (i.e. not called from an isolated event loop).

Modifications:

  • Implement the customisation point directly to avoid the additional checks (the are unecessary by definition of being on the isolated event loop).
  • Add benchmarks

Result:

On the isolated event loop, in micro benchmarks:

  • scheduleTask is ~1.6x faster
  • scheduleCallback is ~2x faster

Motivation:

The schedule callback mechanism on `EventLoop` has an equivalent on an
isolated `EventLoop`. The default isolated implementation puts the
hander in a loop bound box and calls the non-isolated version.

This is okay but introduces a number of additional "in event loop"
checks which are required for correctness in the general case (i.e. not
called from an isolated event loop).

Modifications:

- Implement the customisation point directly to avoid the additional
  checks (the are unecessary by definition of being on the isolated
  event loop).
- Add benchmarks

Result:

On the isolated event loop, in micro benchmarks:
- scheduleTask is ~1.6x faster
- scheduleCallback is ~2x faster
@glbrntt glbrntt added the πŸ”¨ semver/patch No public API change. label Jul 23, 2026
@glbrntt
glbrntt merged commit afc79dd into apple:main Jul 23, 2026
53 of 58 checks passed
@glbrntt
glbrntt deleted the isolated-schedule-callback branch July 23, 2026 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

πŸ”¨ semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants