Skip to content

perf(arrays): defer index string conversion - #75

Merged
BridgeAR merged 1 commit into
mainfrom
BridgeAR/2026-10-12-stringify-perf
Oct 13, 2026
Merged

BridgeAR merged 1 commit into
mainfrom
BridgeAR/2026-10-12-stringify-perf

Conversation

@BridgeAR

Copy link
Copy Markdown
Owner

Array indexes only need strings when they reach toJSON or function replacer callbacks.

A four-number array uses 86 ns instead of 107 ns, a 20% CPU reduction on Node 26.3.1 (V8 14.6.202.34-node.20).
Measurements use 50,000 warmup calls and seven alternating trials, with the fastest and slowest trials removed.

Drive-by fix: Mark intentional invalid-option assertions for TypeScript.

Array indexes only need strings when they reach toJSON or function replacer
callbacks. A four-number array uses 86 ns instead of 107 ns on Node 26.3.1
(V8 14.6.202.34-node.20), a 20% CPU reduction. Measurements use 50,000 warmup
calls and seven alternating trials, with the fastest and slowest removed.

Drive-by fix: Mark intentional invalid-option assertions for TypeScript.
@BridgeAR
BridgeAR marked this pull request as ready for review October 13, 2026 05:13
@BridgeAR
BridgeAR merged commit e8e5b3b into main Oct 13, 2026
5 checks passed
@BridgeAR
BridgeAR deleted the BridgeAR/2026-10-12-stringify-perf branch October 13, 2026 05:14
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