[Do not merge] Fiber-await measurement tooling for node 18 (on #8) - #11
Draft
jbaczuk-qualia wants to merge 2 commits into
Draft
jbaczuk-qualia wants to merge 2 commits into
jbaczuk-qualia wants to merge 2 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
src/fibers.cc:Fiber.microtaskDrains,Fiber.drainsWithDispatch,Fiber.redispatchescounters (plusmicrotasksDispatched/microtasksBatchedfrom [Prototype] Run await continuations from fibers in hidden fibers (needs node#7) #6/[Prototype] Reuse one dispatch fiber and batch await continuations (follow-up to #6) #8).fiber-await/test.js,fiber-await/bench.js,fiber-await/app_stats.mjs,fiber-await/README.md: behaviour checks, microbenchmarks, live-app sampling from a Meteor shell, and how to read them, with reference numbers.fibers_async.js:Fiber.microtasksBatchedkept on the shared native module so it reads correctly when an app loads two copies of fibers (qualia does). Diagnostics only; [Prototype] Reuse one dispatch fiber and batch await continuations (follow-up to #6) #8 still has the per-copy counter.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