revert: single-binding ContextFrame representation; version 0.3.1 - #28
Merged
Merged
Conversation
Measured alone, one binding as a Map costs 26 ns (Node) / 47 ns (Bun) to create against 8-9 ns for a dedicated object: 20-40 ns per Job, under 3% of a Job and invisible end to end. That does not pay for a second frame representation kept in step across three constructors. The consumer that created a one-binding frame per request now hosts its scope on the attachment instead (tiberjs/manager#3), so the case is no longer hot.
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
Reverts the
SingleBindingframe representation from #26 and bumps to 0.3.1. No public behavior change.Why
Measured on its own (2M iterations):
new Map()+ oneset20–40 ns per Job — under 3% of a Job, below anything measurable end to end. That was bundled into #26 with two changes that are 5–10× larger and was carried by their aggregate, not by its own number. It leaves a permanent cost: two representations behind
ContextFramethat every future change to frames must keep in step acrossfrom,with, andwithEntries.The one hot consumer — the server binding
ContainerKeyper request — now hosts its scope on the Runner attachment and creates no per-request frame at all (tiberjs/manager#3), so the one-binding case is no longer on any hot path.Verification
pnpm format,pnpm check,pnpm build,pnpm test(131). Per-Job microbenchmark unchanged within noise (plain Job 0.85 µs, server-shape HandoffJob 1.30 µs on Node).Related: #25, #26