perf: reduce ESM wrapper allocations - #285
Draft
BridgeAR wants to merge 5 commits into
Draft
Conversation
String-based star setters forced the wrapper to build recursive namespace registries and eager deduplication state. Structured binding records allocate conflict state only when a second origin appears. This also keeps repeated paths to one binding unambiguous and preserves explicit null or undefined module.exports values. On Node 24.20.0 with V8 13.6.233.17-node.53, lazy target tracking took 9.31 to 9.38 ns/op in two fresh runs. Eager Set allocation took 27.97 to 30.12 ns/op on the same one-to-three-target workload.
On Node 24.20.0 / V8 13.6.233.17-node.53, a uniform 0/1/2/4/16-export workload improved from 91.86–93.87 to 79.07–80.98 ns/op. Each fresh run used seven trials and dropped the fastest and slowest results.
Real timer scheduling made the retry assertion depend on CI timing instead of the retry state transition.
Application output stays correct when wrapper generation falls back, so output-only assertions could not detect skipped hooks.
BridgeAR
force-pushed
the
BridgeAR/2026-08-27-iitm-esml-v3
branch
from
September 7, 2026 11:40
607feb7 to
9cbf99e
Compare
On the 0/1/2/4/16-export workload, removing the copy improved Node 22.23.1 from 142.69-144.52 ns/op to 92.76-96.27 ns/op.
timfish
approved these changes
Sep 7, 2026
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.
String-based star setters forced the wrapper to build recursive namespace registries and eager deduplication state. Structured binding records allocate conflict state only when a second origin appears.
This also keeps repeated paths to one binding unambiguous and preserves explicit
nullorundefinedmodule.exportsvalues.On Node 24.20.0 with V8 13.6.233.17-node.53, lazy target tracking took 9.31 to 9.38 ns/op in two fresh runs. Eager
Setallocation took 27.97 to 30.12 ns/op on the same one-to-three-target workload.The sync-hook suite found no reproducible end-to-end regression across small, large, TypeScript, star-reexport, and real dependency workloads.