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 — lib,src: improve histogram implementation by jasnell · Pull Request #65024 · nodejs/node

Conversation

@jasnell

@jasnell jasnell commented Aug 4, 2026

Copy link
Copy Markdown
Member

Several improvements:

  1. In histogram-inl, Add previous locked only this->mutex while
    reading the other's fields unsafely.
  2. In histogram.cc, PrepareCB now uses ContainerOf
  3. In histogram.cc, BigInt value range is checked
  4. In histogram.js, simplified impl and reduced duplication
  5. In event_loop_delay.js, use a more consistent constructor
  6. Add additional common histogram analysis operations

There is one potentially/technically breaking change. In Record, we were previously silently truncating when Bigint conversion was lossy. Now it throws. This is technically a bug fix. It's exceedingly unlikely that anyone is depending on the former behavior so I'd rather land this as a minor.

Signed-off-by: James M Snell [email protected]
Assisted-by: Opencode/Opus

Sorry, something went wrong.

Uh oh!

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

All reactions
jasnell added 4 commits August 4, 2026 08:39
@jasnell
lib,src: improve histogram implementation
dd7ecea
Several improvements:

1. In histogram-inl, Add previous locked only this->mutex while
   reading the other's fields unsafely.
2. In histogram.cc, PrepareCB now uses ContainerOf
3. In histogram.cc, BigInt value range is checked
4. In histogram.js, simplified impl and reduced duplication
5. In event_loop_delay.js, use a more consistent constructor

Signed-off-by: James M Snell <[email protected]>
Assisted-by: Opencode/Opus
@jasnell
src: fix histogram mutex locking
63c43c1
Signed-off-by: James M Snell <[email protected]>
Assisted-by: Opencode/Opus
@jasnell
src: improvement histogram implementation
1568571
Signed-off-by: James M Snell <[email protected]>
Assisted-by: Opencode/Opus
@jasnell
perf_hooks: expand histogram analytical apis
4c5ff48
Adds new analytical APIs to Histogram

* histogram.ccdf(value)
* histogram.cdf(value)
* histogram.countAt(value)
* histogram.ksTest(other)
* histogram.kurtosis
* histogram.linearBuckets(stepSize)
* histogram.logBuckets(first, base)
* histogram.percentilesAt(percentiles)
* histogram.shewness

On RecordableHistogram

* histogram.recordCorrected(val, expectedInterval)
* histogram.subtract(other)

Signed-off-by: James M Snell <[email protected]>
@jasnell jasnell added the semver-minor PRs that contain new features and should be released in the next minor version. label Aug 4, 2026
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Aug 4, 2026
@codecov

codecov Bot commented Aug 4, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.45578% with 62 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.32%. Comparing base (1576cb8) to head (4c5ff48).
⚠️ Report is 41 commits behind head on main.

Files with missing lines Patch % Lines
src/histogram.cc 86.03% 22 Missing and 21 partials ⚠️
src/histogram-inl.h 76.27% 8 Missing and 6 partials ⚠️
lib/internal/perf/event_loop_delay.js 72.72% 3 Missing ⚠️
lib/internal/histogram.js 98.97% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65024      +/-   ##
==========================================
+ Coverage   90.30%   90.32%   +0.01%     
==========================================
  Files         759      759              
  Lines      247634   248121     +487     
  Branches    46684    46798     +114     
==========================================
+ Hits       223630   224106     +476     
- Misses      15467    15475       +8     
- Partials     8537     8540       +3     
Files with missing lines Coverage Δ
src/histogram.h 68.42% <100.00%> (+18.42%) ⬆️
lib/internal/histogram.js 94.77% <98.97%> (+4.62%) ⬆️
lib/internal/perf/event_loop_delay.js 94.89% <72.72%> (-1.07%) ⬇️
src/histogram-inl.h 81.30% <76.27%> (-1.13%) ⬇️
src/histogram.cc 82.30% <86.03%> (+1.06%) ⬆️

... and 34 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.

@jasnell
jasnell requested review from BridgeAR and mcollina August 5, 2026 14:55
@nodejs-github-bot

This comment was marked as outdated.

Sign in to view
mcollina
mcollina approved these changes Aug 5, 2026
View reviewed changes

@mcollina mcollina 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

Sorry, something went wrong.

Uh oh!

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

All reactions
@nodejs-github-bot

nodejs-github-bot commented Aug 6, 2026 •
edited by jasnell
Loading

Uh oh!

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

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/75566/ 💛

All reactions

Sorry, something went wrong.

Uh oh!

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

@jasnell jasnell added author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue-squash PRs the Commit Queue should land as one squashed commit. labels Aug 6, 2026
jasnell added a commit that referenced this pull request Aug 12, 2026
@jasnell
lib,src: improve histogram implementation
bfa3e98
Several improvements:

1. In histogram-inl, Add previous locked only this->mutex while
   reading the other's fields unsafely.
2. In histogram.cc, PrepareCB now uses ContainerOf
3. In histogram.cc, BigInt value range is checked
4. In histogram.js, simplified impl and reduced duplication
5. In event_loop_delay.js, use a more consistent constructor

Adds new analytical APIs to Histogram

* histogram.ccdf(value)
* histogram.cdf(value)
* histogram.countAt(value)
* histogram.ksTest(other)
* histogram.kurtosis
* histogram.linearBuckets(stepSize)
* histogram.logBuckets(first, base)
* histogram.percentilesAt(percentiles)
* histogram.shewness

On RecordableHistogram

* histogram.recordCorrected(val, expectedInterval)
* histogram.subtract(other)

Signed-off-by: James M Snell <[email protected]>
Assisted-by: Opencode/Opus
PR-URL: #65024
Reviewed-By: Matteo Collina <[email protected]>
@jasnell

jasnell commented Aug 12, 2026

Copy link
Copy Markdown
Member Author

Landed in bfa3e98

All reactions

Sorry, something went wrong.

Uh oh!

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

@jasnell jasnell closed this Aug 12, 2026
aduh95 pushed a commit that referenced this pull request Aug 13, 2026
@jasnell @aduh95
lib,src: improve histogram implementation
aa21575
Several improvements:

1. In histogram-inl, Add previous locked only this->mutex while
   reading the other's fields unsafely.
2. In histogram.cc, PrepareCB now uses ContainerOf
3. In histogram.cc, BigInt value range is checked
4. In histogram.js, simplified impl and reduced duplication
5. In event_loop_delay.js, use a more consistent constructor

Adds new analytical APIs to Histogram

* histogram.ccdf(value)
* histogram.cdf(value)
* histogram.countAt(value)
* histogram.ksTest(other)
* histogram.kurtosis
* histogram.linearBuckets(stepSize)
* histogram.logBuckets(first, base)
* histogram.percentilesAt(percentiles)
* histogram.shewness

On RecordableHistogram

* histogram.recordCorrected(val, expectedInterval)
* histogram.subtract(other)

Signed-off-by: James M Snell <[email protected]>
Assisted-by: Opencode/Opus
PR-URL: #65024
Reviewed-By: Matteo Collina <[email protected]>
@jasnell jasnell added the notable-change PRs with changes that should be highlighted in changelogs. label Aug 20, 2026
@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

The notable-change PRs with changes that should be highlighted in changelogs. label has been added by @jasnell.

Please suggest a text for the release notes if you'd like to include a more detailed summary, then proceed to update the PR description with the text or a link to the notable change suggested text comment. Otherwise, the commit will be placed in the Other Notable Changes section.

All reactions

Sorry, something went wrong.

Uh oh!

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

@jasnell jasnell added notable-change PRs with changes that should be highlighted in changelogs. and removed notable-change PRs with changes that should be highlighted in changelogs. labels Aug 20, 2026
@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

The notable-change PRs with changes that should be highlighted in changelogs. label has been added by @jasnell.

Please suggest a text for the release notes if you'd like to include a more detailed summary, then proceed to update the PR description with the text or a link to the notable change suggested text comment. Otherwise, the commit will be placed in the Other Notable Changes section.

All reactions

Sorry, something went wrong.

Uh oh!

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

@jasnell

jasnell commented Aug 20, 2026

Copy link
Copy Markdown
Member Author

Notes for the notable change:

This PR introduces a new set of statistical analysis algorithms for Histogram: ccdf(...), cdf(...), ksTest(...), kurtosis, skewness, linear buckets, log buckets, diffing, etc.

All reactions

Sorry, something went wrong.

Uh oh!

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

aduh95 pushed a commit that referenced this pull request Aug 25, 2026
@jasnell @aduh95
lib,src: improve histogram implementation
753033c
Several improvements:

1. In histogram-inl, Add previous locked only this->mutex while
   reading the other's fields unsafely.
2. In histogram.cc, PrepareCB now uses ContainerOf
3. In histogram.cc, BigInt value range is checked
4. In histogram.js, simplified impl and reduced duplication
5. In event_loop_delay.js, use a more consistent constructor

Adds new analytical APIs to Histogram

* histogram.ccdf(value)
* histogram.cdf(value)
* histogram.countAt(value)
* histogram.ksTest(other)
* histogram.kurtosis
* histogram.linearBuckets(stepSize)
* histogram.logBuckets(first, base)
* histogram.percentilesAt(percentiles)
* histogram.shewness

On RecordableHistogram

* histogram.recordCorrected(val, expectedInterval)
* histogram.subtract(other)

Signed-off-by: James M Snell <[email protected]>
Assisted-by: Opencode/Opus
PR-URL: #65024
Reviewed-By: Matteo Collina <[email protected]>
@github-actions github-actions Bot mentioned this pull request Aug 25, 2026
2026-08-26, Version 26.8.0 (Current) #65551
Merged
nodejs-github-bot added a commit that referenced this pull request Aug 25, 2026
@nodejs-github-bot
2026-08-26, Version 26.8.0 (Current)
2161c94
Notable changes:

benchmark:
  * (SEMVER-MINOR) add --analyze mode to compare.js (James M Snell) #65416
crypto:
  * update root certificates to NSS 3.126 (Node.js GitHub Bot) #65495
  * (SEMVER-MINOR) enable SIV and GCM-SIV modes in Cipher/Decipher APIs (Filip Skokan) #63411
diagnostics_channel:
  * mark TracingChannel as stable (Abdelrahman Awad) #64525
lib,src:
  * (SEMVER-MINOR) improve histogram implementation (James M Snell) #65024
net:
  * (SEMVER-MINOR) improve performance of net.BlockList (James M Snell) #64974
perf_hooks:
  * (SEMVER-MINOR) add statistical hypothesis testing to histogram (James M Snell) #65416
repl:
  * add basic syntax highlighting (Aviv Keller) #64591
sqlite:
  * (SEMVER-MINOR) add StatementSync.prototype.close() (Guilherme Araújo) #64232
  * (SEMVER-MINOR) add StatementSync.prototype[Symbol.dispose]() (Guilherme Araújo) #64232
util:
  * (SEMVER-MINOR) add non-throwing MIMEType.parse (James M Snell) #64965
zlib:
  * (SEMVER-MINOR) add ZipEntry, ZipFile, and ZipBuffer (Philipp Dunkel) #64339

PR-URL: #65551
aduh95 pushed a commit that referenced this pull request Aug 26, 2026
@nodejs-github-bot @aduh95
2026-08-26, Version 26.8.0 (Current)
30542c3
Notable changes:

benchmark:
  * (SEMVER-MINOR) add --analyze mode to compare.js (James M Snell) #65416
crypto:
  * update root certificates to NSS 3.126 (Node.js GitHub Bot) #65495
  * (SEMVER-MINOR) enable SIV and GCM-SIV modes in Cipher/Decipher APIs (Filip Skokan) #63411
diagnostics_channel:
  * mark TracingChannel as stable (Abdelrahman Awad) #64525
lib,src:
  * (SEMVER-MINOR) improve histogram implementation (James M Snell) #65024
net:
  * (SEMVER-MINOR) improve performance of net.BlockList (James M Snell) #64974
perf_hooks:
  * (SEMVER-MINOR) add statistical hypothesis testing to histogram (James M Snell) #65416
repl:
  * add basic syntax highlighting (Aviv Keller) #64591
sqlite:
  * (SEMVER-MINOR) add StatementSync.prototype.close() (Guilherme Araújo) #64232
  * (SEMVER-MINOR) add StatementSync.prototype[Symbol.dispose]() (Guilherme Araújo) #64232
util:
  * (SEMVER-MINOR) add non-throwing MIMEType.parse (James M Snell) #64965
zlib:
  * (SEMVER-MINOR) add ZipEntry, ZipFile, and ZipBuffer (Philipp Dunkel) #64339

PR-URL: #65551
aduh95 pushed a commit that referenced this pull request Aug 27, 2026
@jasnell @aduh95
lib,src: improve histogram implementation
0529772
Several improvements:

1. In histogram-inl, Add previous locked only this->mutex while
   reading the other's fields unsafely.
2. In histogram.cc, PrepareCB now uses ContainerOf
3. In histogram.cc, BigInt value range is checked
4. In histogram.js, simplified impl and reduced duplication
5. In event_loop_delay.js, use a more consistent constructor

Adds new analytical APIs to Histogram

* histogram.ccdf(value)
* histogram.cdf(value)
* histogram.countAt(value)
* histogram.ksTest(other)
* histogram.kurtosis
* histogram.linearBuckets(stepSize)
* histogram.logBuckets(first, base)
* histogram.percentilesAt(percentiles)
* histogram.shewness

On RecordableHistogram

* histogram.recordCorrected(val, expectedInterval)
* histogram.subtract(other)

Signed-off-by: James M Snell <[email protected]>
Assisted-by: Opencode/Opus
PR-URL: #65024
Reviewed-By: Matteo Collina <[email protected]>
@github-actions github-actions Bot mentioned this pull request Sep 7, 2026
2026-09-08, Version 24.21.0 'Krypton' (LTS) #65873
Merged
nodejs-github-bot added a commit that referenced this pull request Sep 7, 2026
@nodejs-github-bot
2026-09-08, Version 24.21.0 'Krypton' (LTS)
69505d7
Notable changes:

benchmark:
  * (SEMVER-MINOR) add --analyze mode to compare.js (James M Snell) #65416
crypto:
  * update root certificates to NSS 3.126 (Node.js GitHub Bot) #65495
  * (SEMVER-MINOR) support loading private keys through STORE loaders (Filip Skokan) #63949
lib,src:
  * (SEMVER-MINOR) improve histogram implementation (James M Snell) #65024
net:
  * (SEMVER-MINOR) improve performance of net.BlockList (James M Snell) #64974
perf_hooks:
  * (SEMVER-MINOR) add statistical hypothesis testing to histogram (James M Snell) #65416
util:
  * (SEMVER-MINOR) add non-throwing MIMEType.parse (James M Snell) #64965

PR-URL: #65873
aduh95 added a commit that referenced this pull request Sep 7, 2026
@aduh95
2026-09-08, Version 24.21.0 'Krypton' (LTS)
a76b285
Notable changes:

crypto:
  * update root certificates to NSS 3.126 (Node.js GitHub Bot) #65495
  * (SEMVER-MINOR) support loading private keys through STORE loaders (Filip Skokan) #63949
deps:
  * update OpenSSL to 3.5.8 (Node.js GitHub Bot) #65542
  * update Undici to 7.29.1 (Node.js GitHub Bot) #65789
lib,src:
  * (SEMVER-MINOR) improve histogram implementation (James M Snell) #65024
net:
  * (SEMVER-MINOR) improve performance of `net.BlockList` (James M Snell) #64974
perf_hooks:
  * (SEMVER-MINOR) add statistical hypothesis testing to histogram (James M Snell) #65416
util:
  * (SEMVER-MINOR) add non-throwing `MIMEType.parse` (James M Snell) #64965

PR-URL: #65873
aduh95 added a commit that referenced this pull request Sep 7, 2026
@aduh95
2026-09-08, Version 24.21.0 'Krypton' (LTS)
955266b
Notable changes:

crypto:
  * update root certificates to NSS 3.126 (Node.js GitHub Bot) #65495
  * (SEMVER-MINOR) support loading private keys through STORE loaders (Filip Skokan) #63949
deps:
  * update OpenSSL to 3.5.8 (Node.js GitHub Bot) #65542
  * update Undici to 7.29.1 (Node.js GitHub Bot) #65789
lib,src:
  * (SEMVER-MINOR) improve histogram implementation (James M Snell) #65024
net:
  * (SEMVER-MINOR) improve performance of `net.BlockList` (James M Snell) #64974
perf_hooks:
  * (SEMVER-MINOR) add statistical hypothesis testing to histogram (James M Snell) #65416
util:
  * (SEMVER-MINOR) add non-throwing `MIMEType.parse` (James M Snell) #64965

PR-URL: #65873
aduh95 added a commit that referenced this pull request Sep 8, 2026
@aduh95
2026-09-08, Version 24.21.0 'Krypton' (LTS)
9afe7dc
Notable changes:

crypto:
  * update root certificates to NSS 3.126 (Node.js GitHub Bot) #65495
  * (SEMVER-MINOR) support loading private keys through STORE loaders (Filip Skokan) #63949
deps:
  * update OpenSSL to 3.5.8 (Node.js GitHub Bot) #65542
  * update Undici to 7.29.1 (Node.js GitHub Bot) #65789
lib,src:
  * (SEMVER-MINOR) improve histogram implementation (James M Snell) #65024
net:
  * (SEMVER-MINOR) improve performance of `net.BlockList` (James M Snell) #64974
perf_hooks:
  * (SEMVER-MINOR) add statistical hypothesis testing to histogram (James M Snell) #65416
util:
  * (SEMVER-MINOR) add non-throwing `MIMEType.parse` (James M Snell) #64965

PR-URL: #65873
@github-actions github-actions Bot mentioned this pull request Sep 9, 2026
chore(deps): update dependency node to v24.21.0 tailor-platform/sdk#2309
Merged
1 task
@SimonSchick SimonSchick mentioned this pull request Oct 10, 2026
feat: backfill various missing node APIs DefinitelyTyped/DefinitelyTyped#75760
Open
8 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mcollina mcollina mcollina approved these changes
@BridgeAR BridgeAR Awaiting requested review from BridgeAR

Uh oh!

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

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-squash PRs the Commit Queue should land as one squashed commit. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. notable-change PRs with changes that should be highlighted in changelogs. semver-minor PRs that contain new features and should be released in the next minor version.

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.

3 participants

@jasnell @nodejs-github-bot @mcollina
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.