Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: improve TernarySearchTree #2782

Merged
merged 3 commits into from
Feb 20, 2024
Merged

Conversation

Uzlopak
Copy link
Contributor

@Uzlopak Uzlopak commented Feb 19, 2024

before:

aras@aras-Lenovo-Legion-5-17ARH05H:~/workspace/undici$ node benchmarks/TernarySearchTree.mjs 
cpu: AMD Ryzen 7 4800H with Radeon Graphics
runtime: node v21.6.2 (x64-linux)

benchmark           time (avg)             (min … max)       p75       p99      p999
------------------------------------------------------ -----------------------------
• tree.search
------------------------------------------------------ -----------------------------
content-length  35'297 ps/iter    (33'693 ps … 337 ns) 34'613 ps 40'718 ps    109 ns
CONTENT-LENGTH  35'353 ps/iter    (34'034 ps … 368 ns) 34'954 ps 40'991 ps 82'356 ps
Content-Length  34'016 ps/iter (32'977 ps … 71'478 ps) 33'795 ps 39'354 ps 60'906 ps

summary for tree.search
  Content-Length
   1.04x faster than content-length
   1.04x faster than CONTENT-LENGTH

after:

aras@aras-Lenovo-Legion-5-17ARH05H:~/workspace/undici$ node benchmarks/TernarySearchTree.mjs 
cpu: AMD Ryzen 7 4800H with Radeon Graphics
runtime: node v21.6.2 (x64-linux)

benchmark           time (avg)             (min … max)       p75       p99      p999
------------------------------------------------------ -----------------------------
• tree.search
------------------------------------------------------ -----------------------------
content-length  32'567 ps/iter    (30'964 ps … 379 ns) 31'919 ps 37'205 ps 93'200 ps
CONTENT-LENGTH  35'016 ps/iter    (33'761 ps … 174 ns) 34'716 ps 39'183 ps 89'211 ps
Content-Length  32'719 ps/iter (31'578 ps … 77'070 ps) 32'499 ps 36'625 ps 64'691 ps

summary for tree.search
  content-length
   1x faster than Content-Length
   1.08x faster than CONTENT-LENGTH

@codecov-commenter
Copy link

codecov-commenter commented Feb 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e39a632) 85.54% compared to head (5ca863c) 85.40%.
Report is 319 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2782      +/-   ##
==========================================
- Coverage   85.54%   85.40%   -0.15%     
==========================================
  Files          76       85       +9     
  Lines        6858     7605     +747     
==========================================
+ Hits         5867     6495     +628     
- Misses        991     1110     +119     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Co-authored-by: tsctx <91457664+tsctx@users.noreply.github.com>
@metcoder95 metcoder95 merged commit 78934db into nodejs:main Feb 20, 2024
17 checks passed
@Uzlopak Uzlopak deleted the improve-trie branch February 20, 2024 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants