Repository navigation
fix(typed-array): serialize non-finite floating-point values - #73
Merged
Merged
Conversation
A formatter closure adds finite checks to integer arrays and an extra call for floating-point values. Inline checks retain direct conversion for integer and BigInt arrays. On Node 24.20.0 (V8 13.6.233.17-node.53), CPU time per call falls from 4.92 to 4.11 µs for 128 indented Int32Array values. For 128 compact Float64Array values, it falls from 8.27 to 7.54 µs. These means use two fresh processes with 50k warmup calls and seven trials per shape, excluding the extremes. Refs: #69
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.
Floating typed arrays bypass number normalization in the optimized paths, so NaN and infinities produce invalid JSON and escape strict-mode rejection.
The maintainer changes restrict finite checks to floating-point arrays and run them inline, preserving direct conversion for integer and BigInt arrays.
On Node 24.20.0 (V8 13.6.233.17-node.53), CPU time per call falls from 4.92 to 4.11 µs against the contributor commit for 128 indented Int32Array values. For 128 compact Float64Array values, it falls from 8.27 to 7.54 µs. These means use two fresh processes with 50k warmup calls and seven trials per shape, excluding the extremes.
Closes: #69
Fixes: #68