Skip to content

Make concurrency take over cheaper#3527

Merged
Lukasa merged 2 commits intoapple:mainfrom
Lukasa:cb-take-over-cheaper
Feb 27, 2026
Merged

Make concurrency take over cheaper#3527
Lukasa merged 2 commits intoapple:mainfrom
Lukasa:cb-take-over-cheaper

Conversation

@Lukasa
Copy link
Copy Markdown
Contributor

@Lukasa Lukasa commented Feb 27, 2026

Motivation:

When using concurrency takeover, we currently spend nearly half the runtime checking if our SelectableEventLoop has an enqueue function. We know it does, but we just haven't given the compiler enough evidence. This patch rewrites the code to prove it to the compiler.

Modifications:

  • Expose internal functions without erased types on MTELG
  • Use these internal functions, and call directly to SEL, eliminiating the as!.

Result:

Massive perf improvement in task enqueueing.

Motivation:

When using concurrency takeover, we currently spend nearly half the runtime
checking if our SelectableEventLoop has an enqueue function. We know it does,
but we just haven't given the compiler enough evidence. This patch rewrites
the code to prove it to the compiler.

Modifications:

- Expose internal functions without erased types on MTELG
- Use these internal functions, and call directly to SEL, eliminiating
    the as!.

Result:

Massive perf improvement in task enqueueing.
@Lukasa Lukasa added the 🔨 semver/patch No public API change. label Feb 27, 2026
@Lukasa Lukasa enabled auto-merge (squash) February 27, 2026 13:48
@Lukasa Lukasa merged commit 41fc4a7 into apple:main Feb 27, 2026
55 checks passed
@Lukasa Lukasa deleted the cb-take-over-cheaper branch February 27, 2026 13:59
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