GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — assert: avoid excess float array comparisons by alejandrodev-vn · Pull Request #67357 · nodejs/node

Conversation

@alejandrodev-vn

@alejandrodev-vn alejandrodev-vn commented Nov 9, 2026

Copy link
Copy Markdown

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 7ae68bd.
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: #51040

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@alejandrodev-vn
assert: avoid excess float array comparisons
e8b4c0b
Signed-off-by: alejandrodev-vn <[email protected]>
@nodejs-github-bot

nodejs-github-bot commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/performance
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module. labels Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

  • the guide for first-time contributors
  • the contribution and automation policies
  • the pull request guide
  • the AI use policy
  • the Code of Conduct

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

BridgeAR
BridgeAR approved these changes Nov 9, 2026
View reviewed changes

@BridgeAR BridgeAR left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you! Should we also add strict assertions?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Renegade334
Renegade334 approved these changes Nov 9, 2026
View reviewed changes
@codecov

codecov Bot commented Nov 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.72%. Comparing base (f344e7f) to head (e2baf00).
⚠️ Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67357      +/-   ##
==========================================
- Coverage   90.73%   90.72%   -0.01%     
==========================================
  Files         798      798              
  Lines      279993   280018      +25     
  Branches    53866    53859       -7     
==========================================
+ Hits       254047   254059      +12     
- Misses      16229    16271      +42     
+ Partials     9717     9688      -29     
Files with missing lines Coverage Δ
lib/internal/util/comparisons.js 99.53% <100.00%> (+<0.01%) ⬆️

... and 32 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ljharb
ljharb approved these changes Nov 10, 2026
View reviewed changes
@alejandrodev-vn
test: add strict float array assertions
e2baf00
Signed-off-by: alejandrodev-vn <[email protected]>
@alejandrodev-vn

alejandrodev-vn commented Nov 10, 2026

Copy link
Copy Markdown
Author

LGTM, thank you! Should we also add strict assertions?

@BridgeAR Thanks! Added strict assertions in e2baf00 for all three float array types. The updated test and ESLint pass locally

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Renegade334
Renegade334 approved these changes Nov 10, 2026
View reviewed changes
@Renegade334 Renegade334 added the commit-queue-squash PRs the Commit Queue should land as one squashed commit. label Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ljharb ljharb ljharb approved these changes
@BridgeAR BridgeAR BridgeAR approved these changes
@Renegade334 Renegade334 Renegade334 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

commit-queue-squash PRs the Commit Queue should land as one squashed commit. needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@alejandrodev-vn @nodejs-github-bot @ljharb @BridgeAR @Renegade334
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.