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 — fix: improve range parsing performance by reggi · Pull Request #918 · npm/node-semver

Conversation

@reggi

@reggi reggi commented Oct 8, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Summary

  • Replace comparator whitespace normalization with a regex-free scanner that preserves legacy match boundaries.
  • Cache numeric lookahead to avoid repeatedly scanning overlapping digit runs.
  • Share the ECMAScript whitespace definition between production and tests, using a byte lookup table rather than a Set.
  • Add legacy compatibility checks and large-prefix/numeric-input regression coverage.

Stack

Originally stacked on #917, which was squash-merged into main as 7257c14. Rebased onto main after that merge so this PR contains only the comparator normalization implementation and its tests. The implementation patch is unchanged.

Validation

  • Full npm test passed: 54 test files, 100% coverage, ESLint, and template checks.
  • Differential review: 302,520 scanner cases and 100,000 Range cases matched the parent implementation.
  • Whitespace lookup: 196,608 differential cases matched the original scanner across all UTF-16 code units.
  • Large invalid-prefix parsing improved dramatically; numeric-lookahead access counts scaled linearly through one million characters.

Performance tradeoff

Local Node v26 benchmarks showed approximately 6–7% slower ordinary uncached Range parsing versus the original regex. The shared byte-table lookup did not introduce the additional slowdown observed with Set-based membership checks. Measurements are local microbenchmarks, not cross-runtime guarantees.

Sorry, something went wrong.

Uh oh!

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

All reactions
@reggi
reggi requested a review from a team as a code owner October 8, 2026 15:08
This was referenced Oct 8, 2026
chore: cover comparator normalization #917
Merged
fix: improve range parsing performance #899
Closed
reggi added a commit that referenced this pull request Oct 16, 2026
@reggi
fix: avoid comparator trim regex in v7 range parsing
b598ea8
Use the regex-free forward scanner from PR #918 while retaining the existing regex exports.

Include regression coverage for compatibility, exported regex preservation, and parsing without COMPARATORTRIM execution.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 03b4a44c-26a3-4d56-9b26-cd46006844c6
@reggi
reggi force-pushed the reggi/improve-range-parsing-performance branch from 66d057c to b598ea8 Compare October 16, 2026 19:33
@reggi
reggi force-pushed the reggi/chore-adds-tests branch from 6e8d7d1 to 0fc683a Compare October 16, 2026 19:33
This was referenced Oct 16, 2026
chore: backport v7 range parsing coverage to v6 #924
Merged
fix: backport v7 range parsing performance improvement to v6 #925
Merged
chore: backport v7 range parsing coverage to v5 #926
Merged
fix: backport v7 range parsing performance improvement to v5 #927
Merged
nishantms
nishantms previously approved these changes Oct 16, 2026
View reviewed changes
martinrrm
martinrrm previously approved these changes Oct 19, 2026
View reviewed changes
nkolev92
nkolev92 previously approved these changes Oct 19, 2026
View reviewed changes
Comment thread internal/trim-comparator-whitespace.js
whitespace[char.charCodeAt(0)] = 1
}

/**

@nkolev92 nkolev92 Oct 19, 2026

Copy link
Copy Markdown

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.

nit: The full description on helpers like isWhitespace, isDigit and a few others feel heavier than the implementation.
Just something to consider.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread internal/trim-comparator-whitespace.js
}

/**
* Reads a number using the old regex's length and leading-zero rules.

@nkolev92 nkolev92 Oct 19, 2026

Copy link
Copy Markdown

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.

This is a temporal comment, so it only makes sense in the context of the PR, but probably needs more detail to stand independently.

Sorry, something went wrong.

Uh oh!

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

All reactions
reggi added a commit that referenced this pull request Oct 20, 2026
@reggi
chore: cover comparator normalization (#917)
7257c14
## Summary
- Add regression fixtures and integration coverage for comparator
whitespace, equality boundaries, and malformed loose alternatives.
- Cover long prerelease identifiers, build-metadata normalization, and
existing version limits across strict/loose and prerelease options.
- Tests only; no production behavior changes.

## Stack
First of two stacked PRs; followed by #918. Contains only commit
1eda6b4. Merge this PR before the
performance implementation.

## Validation
Full `npm test` (including coverage, ESLint, and template checks) passes
on the combined stack.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 03b4a44c-26a3-4d56-9b26-cd46006844c6
Base automatically changed from reggi/chore-adds-tests to main October 20, 2026 17:07
@reggi
reggi dismissed stale reviews from nkolev92, martinrrm, and nishantms October 20, 2026 17:07

The base branch was changed.

reggi added a commit that referenced this pull request Oct 20, 2026
@reggi
chore: backport v7 range parsing coverage to v5 (#926)
b827b90
## Summary
Backport the v7 range parsing coverage from #917 to v5. Add coverage for
comparator whitespace normalization, range parsing options, equality
boundaries, malformed loose alternatives, long identifiers, and build
metadata.

Use the same range fixture inputs and options as v7 while preserving
v5-specific expected results. Tests only; no production code or
dependency changes.

## Stack
First of two stacked v5 backport PRs, based on `release/v5`. Contains
test commit `8bbf475`. The follow-up backport of the v7 performance fix
in #918 targets this branch. Merge this PR before the v5 fix.

The follow-up v5 fix is #927.

## Validation
The full v5 test suite passed locally on Node 20.19.5 with 100%
statement, branch, function, and line coverage; one test was skipped.
The full supported Node-version matrix remains unverified locally.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 03b4a44c-26a3-4d56-9b26-cd46006844c6
reggi added a commit that referenced this pull request Oct 20, 2026
@reggi
chore: backport v7 range parsing coverage to v6 (#924)
9a3f125
## Summary
Backport the v7 range parsing coverage from #917 to v6. Add coverage for
comparator whitespace normalization, range parsing options, equality
boundaries, malformed loose alternatives, long identifiers, and build
metadata.

Use the same range fixture inputs and options as v7 while preserving
v6-specific expected results. Tests only; no production code or
dependency changes.

## Stack
First of two stacked v6 backport PRs, based on `release/v6`. Contains
test commit `b381d7f`. The follow-up backport of the v7 performance fix
in #918 targets this branch. Merge this PR before the v6 fix.

The follow-up v6 fix is #925.

## Validation
The full v6 test suite passed locally on Node 20.19.5 with 100%
statement, branch, function, and line coverage; one test was skipped.
The full supported Node-version matrix remains unverified locally.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 03b4a44c-26a3-4d56-9b26-cd46006844c6
@reggi
fix: avoid comparator trim regex in v7 range parsing
1b3a949
Use the regex-free forward scanner from PR #918 while retaining the existing regex exports.

Include regression coverage for compatibility, exported regex preservation, and parsing without COMPARATORTRIM execution.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 03b4a44c-26a3-4d56-9b26-cd46006844c6
@reggi
reggi force-pushed the reggi/improve-range-parsing-performance branch from b598ea8 to 1b3a949 Compare October 21, 2026 19:19
nishantms
nishantms approved these changes Oct 30, 2026
View reviewed changes
martinrrm
martinrrm approved these changes Oct 30, 2026
View reviewed changes
nkolev92
nkolev92 approved these changes Oct 30, 2026
View reviewed changes
@reggi
reggi merged commit 69b305d into main Nov 2, 2026
36 checks passed

Uh oh!

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

@reggi
reggi deleted the reggi/improve-range-parsing-performance branch November 2, 2026 15:51
reggi added a commit that referenced this pull request Nov 2, 2026
@reggi
fix: backport v7 range parsing performance improvement to v6 (#925)
f4ed953
## Summary
Backport the v7 range parsing performance fix from #918 to v6. Replace
execution of `COMPARATORTRIM` during range parsing with a regex-free
whitespace scanner while preserving the existing exported regexes.

Preserve v6-specific parsing behavior, including numeric-first
prerelease matching. Add coverage confirming legacy compatibility,
exported regex preservation, and parsing without executing
`COMPARATORTRIM`.

## Stack
Depends on #924, the v6 coverage backport of #917. This PR targets
`reggi/chore-adds-tests-v6` so its diff contains only fix commit
`9d1812e`. Merge #924 first, then retarget this PR to `release/v6` if
GitHub does not do so automatically.

## Validation
The full v6 test suite passed locally on Node 20.19.5 with 100%
statement, branch, function, and line coverage; one test was skipped.
Additional differential checks matched the legacy regex across 30,870
cases. The full supported Node-version matrix remains unverified
locally.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 03b4a44c-26a3-4d56-9b26-cd46006844c6
reggi added a commit that referenced this pull request Nov 2, 2026
@reggi
fix: backport v7 range parsing performance improvement to v5 (#927)
7227001
## Summary
Backport the v7 range parsing performance fix from #918 to v5. Replace
execution of `COMPARATORTRIM` during range parsing with a regex-free
whitespace scanner while preserving the existing exported regexes.

Preserve v5-specific parsing behavior, including numeric-first
prerelease matching. Add coverage confirming legacy compatibility,
exported regex preservation, and parsing without executing
`COMPARATORTRIM`.

## Stack
Depends on #926, the v5 coverage backport of #917. This PR targets
`reggi/chore-adds-tests-v5` so its diff contains only fix commit
`4a94e99`. Merge #926 first, then retarget this PR to `release/v5` if
GitHub does not do so automatically.

## Validation
The full v5 test suite passed locally on Node 20.19.5 with 100%
statement, branch, function, and line coverage; one test was skipped.
Additional differential checks matched the legacy regex across 30,870
cases. The full supported Node-version matrix remains unverified
locally.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 03b4a44c-26a3-4d56-9b26-cd46006844c6
@github-actions github-actions Bot mentioned this pull request Nov 2, 2026
chore: release 7.8.6 #940
Merged
reggi pushed a commit that referenced this pull request Nov 2, 2026
@github-actions
chore: release 7.8.6 (#940)
b37b033
🤖 I have created a release *beep* *boop*
---


## [7.8.6](v7.8.5...v7.8.6)
(2026-11-02)
### Bug Fixes
*
[`69b305d`](69b305d)
[#918](#918) improve range
parsing performance (#918) (@reggi, @Copilot)
### Chores
*
[`7257c14`](7257c14)
[#917](#917) cover comparator
normalization (#917) (@reggi, @Copilot)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@Nee200 Nee200 mentioned this pull request Nov 3, 2026
fix(security): bound pathological advisory range parsing Nee200/note-backend#24
Merged
@aversini aversini mentioned this pull request Nov 4, 2026
fix: bump non-breaking dependencies to latest versini-org/node-cli#733
Merged
@claude claude Bot mentioned this pull request Nov 6, 2026
build(deps): update dependency semver to v7.8.6 ncaq/konoka#543
Merged
1 task
This was referenced Nov 6, 2026
Lockfile maintenance knu/vscode-easy-kill#67
Merged
Lockfile maintenance knu/obaq#116
Merged
Lockfile maintenance knu/vscode-word-inflection#65
Merged
Lockfile maintenance knu/vscode-editor-focus-notifier#74
Merged
Lockfile maintenance knu/tabsquad#99
Merged
@gitar-bot gitar-bot Bot mentioned this pull request Nov 9, 2026
Update dependency semver to v7.8.6 SonarSource/sonarlint-vscode#1286
Merged
1 task
@viell-dev viell-dev mentioned this pull request Nov 9, 2026
Upstream defects: what is parked, how it is worked around, and what was reported viell-dev/slop-markdown-tools#330
Open
@mridang mridang mentioned this pull request Nov 11, 2026
chore(deps): bump the npm-security-updates group across 1 directory with 3 updates mridang/semantic-release-packagist#45
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@nkolev92 nkolev92 nkolev92 approved these changes
@martinrrm martinrrm martinrrm approved these changes
@nishantms nishantms nishantms approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

None yet

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.

4 participants

@reggi @nkolev92 @martinrrm @nishantms
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 01402520 — 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.