Skip to content

[Do not merge] Fiber-await measurement tooling for node 18 (on #8) - #11

Draft
jbaczuk-qualia wants to merge 2 commits into
jbaczuk/fiber-await-v18-reusefrom
jbaczuk/fiber-await-v18-reuse-stats
Draft

jbaczuk-qualia wants to merge 2 commits into
jbaczuk/fiber-await-v18-reusefrom
jbaczuk/fiber-await-v18-reuse-stats

Conversation

@jbaczuk-qualia

@jbaczuk-qualia jbaczuk-qualia commented Oct 2, 2026 •

Copy link
Copy Markdown

Summary

Do not merge. Measurement tooling for the node 18 fiber-await prototype, stacked on #8 so it never ships; build fibers from this branch only in environments you want to measure. The node 24 version is #10.

In local qualia this measured, over 88 s of clicking: 13.7% of promise callbacks tagged, 3.2% of untagged callbacks causing a switch, 71% of tagged callbacks batched; ~4,700 switches at ~20-45 us each (~0.1-0.25% of a core).

🤖 Generated with Claude Code

jbaczuk-qualia and others added 2 commits October 2, 2026 09:34
Diagnostics for the reusing dispatcher: Fiber.microtaskDrains (default
queue checkpoints, including empty ones), Fiber.drainsWithDispatch
(drains that switched onto a dispatch fiber) and Fiber.redispatches
(further switches within the same drain, i.e. an untagged job between
two tagged ones sent us back to the main stack).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a branch of its own so it never ships; build fibers from it only
where you want to measure:

- fiber-await/test.js: behaviour checks (await then block, ALS across
  the hop, Promise.all overlap, Fiber.current still hidden, fiberless
  code untouched, ...), with FIBERS_AWAIT_REUSE / FIBERS_AWAIT_DISPATCH
  switches for comparison.
- fiber-await/bench.js: switch round trip, chained / I/O-style /
  interleaved awaits in a fiber, fiberless awaits, drains, park cycles.
  Runs on stock node + fibers too.
- fiber-await/app_stats.mjs: sample a running app from a Meteor shell
  (share of promise callbacks tagged, share of untagged that caused a
  switch, drains with dispatch, batched share, in-process switch cost).
- fiber-await/README.md: how to run and read all of it, with reference
  numbers.

Also keep Fiber.microtasksBatched on the shared native module, so it
reads correctly when an app loads more than one copy of fibers_async.js.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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