perf_hooks: implement qrde analysis support in Histogram - #65806
Open
jasnell wants to merge 1 commit into
Open
Conversation
Implements quantile-respectful density estimate calcuation on Histogram. Helps with tail-focused latency analysis without retaining raw samples. Baking this directly into Node.js, based on a 1 million sample, 1k bin workload, this impl is roughly 150-325x faster than performing the equivalent in Rscript. Signed-off-by: James M Snell <[email protected]> Assisted-by: Opencode
Collaborator
|
Review requested:
|
mcollina
approved these changes
Sep 5, 2026
mcollina
left a comment
Member
There was a problem hiding this comment.
RSLGTM
have you verified the algorithm against a reference implementation?
Is this such a complex computation that requires using the thread pool?
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #65806 +/- ##
==========================================
+ Coverage 90.14% 90.16% +0.02%
==========================================
Files 769 769
Lines 262968 263424 +456
Branches 50052 50140 +88
==========================================
+ Hits 237049 237515 +466
+ Misses 16924 16894 -30
- Partials 8995 9015 +20
🚀 New features to boost your workflow:
|
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.
Continue expanding the built-in statistical analysis capabilities of
perf_hooksHistogram.Implements quantile-respectful density estimate (qrde) calculation on Histogram. Helps with tail-focused latency analysis without retaining raw samples. Think of it as a way of generating and exporting a compact analysis of the collected metrics without having to export the entire bucket. Very useful for generating plots of latency data.
Baking this directly into Node.js, based on a 1 million sample, 1k bin workload, this impl is roughly 150-325x faster than performing the equivalent in Rscript.
It's an async API because, while calculation should typically be quite fast for reasonably sized sample sets, the cost can compound as the number of buckets in the Histogram increases.
Example application that uses it: https://gist.github.com/jasnell/a5283d73b4ef6bb6e4e549bf15dc8f70