← Back to Pull requests

assert: avoid excess float array comparisons #67357

Open
unknown opened this pull request with 410 lines diff across 5 files
View on GitHub
unknown unknown commented on Nov 09, 2026 10:00 UTC
Author

areSimilarFloatArrays() uses the byte length as the loop bound while
accessing typed array elements by index. For equal arrays, this causes
unnecessary out-of-bounds reads after all elements have been compared.

Use TypedArrayPrototypeGetLength for the length check and loop bound.
The intrinsic getter avoids invoking an own length property.

Add coverage for Float16Array, Float32Array and Float64Array, including
subarrays, empty arrays, unequal lengths and shadowed length getters.
Add a benchmark covering equal arrays and several mismatch scenarios.

Local benchmark results for equal arrays with 5,000 elements:

| Type | Before (ops/s) | After (ops/s) | Ratio |
| --- | ---: | ---: | ---: |
| Float16Array | 12,561 | 29,195 | 2.32x |
| Float32Array | 17,774 | 229,386 | 12.91x |
| Float64Array | 9,707 | 232,215 | 23.92x |

These are median throughput results from 12 alternating before/after
runs on an Apple M4 Pro, macOS arm64, using a v28.0.0-pre development
build based on 7ae68bd0f41ee8e18966fbdc6312405a292a241c.
The build loads builtins from disk. These measurements apply to this
microbenchmark and do not measure application throughput.

Validation:

  • make lint

  • make lint-yaml (completed with two comment-spacing warnings)

  • make -j4 test (7,619 passed, 0 failed)
  • Refs: https://github.com/nodejs/node/pull/51040

    <!--
    If you are submitting a pull request for the first time,
    check out the guide for first-time contributors for tips and answers to FAQs:
    https://github.com/nodejs/node/blob/HEAD/doc/contributing/first-contributions.md

    Before submitting a pull request, please read:

  • the CONTRIBUTING guide at https://github.com/nodejs/node/blob/HEAD/CONTRIBUTING.md

  • the commit message formatting guidelines at

  • https://github.com/nodejs/node/blob/HEAD/doc/contributing/pull-requests.md#commit-message-guidelines

    For code changes:
    1. Include tests for any bug fixes or new features.
    2. Update documentation if relevant.
    3. Ensure that make -j4 test (UNIX), or vcbuild test (Windows) passes.

    If you believe this PR should be highlighted in the Node.js CHANGELOG
    please add the notable-change label.

    Developer's Certificate of Origin 1.1

    By making a contribution to this project, I certify that:

    (a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

    (b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

    (c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

    (d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.
    -->

    Diff: 410 lines (+307 / -103) across 5 files Reviewer: Renegade334 Review duration: 19344m
    All Vouch review confidence checks passed
    Residual risk 0.24 = Change Risk (0.45) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 410 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.360
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #67357"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 44.9% (MEDIUM) · Higher = larger blast radius
    44.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 23.9% · Safe to merge
    23.9%
    Repository