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: try to re-use timer when possible #729

Merged
merged 18 commits into from
Apr 13, 2021
Merged

perf: try to re-use timer when possible #729

merged 18 commits into from
Apr 13, 2021

Conversation

ronag
Copy link
Member

@ronag ronag commented Apr 12, 2021

No description provided.

@ronag
Copy link
Member Author

ronag commented Apr 12, 2021

root@467caf9088f0:/undici# node benchmarks/index.js 
http - no agent  x 3,824 ops/sec ±6.06% (75 runs sampled)
http - keepalive x 733 ops/sec ±1.18% (78 runs sampled)
http - keepalive - multiple sockets x 5,001 ops/sec ±1.05% (80 runs sampled)
undici - pipeline x 5,420 ops/sec ±3.56% (78 runs sampled)
undici - request x 6,117 ops/sec ±1.62% (83 runs sampled)
undici - pool - request - multiple sockets x 6,111 ops/sec ±1.09% (81 runs sampled)
undici - stream x 6,514 ops/sec ±1.42% (80 runs sampled)
undici - dispatch x 6,871 ops/sec ±0.71% (84 runs sampled)
undici - noop x 7,001 ops/sec ±0.69% (83 runs sampled)
root@467caf9088f0:/undici# git checkout reuse-timers
Branch reuse-timers set up to track remote branch reuse-timers from origin.
Switched to a new branch 'reuse-timers'
root@467caf9088f0:/undici# node benchmarks/index.js 
http - no agent  x 4,047 ops/sec ±4.75% (80 runs sampled)
http - keepalive x 757 ops/sec ±0.81% (77 runs sampled)
http - keepalive - multiple sockets x 4,952 ops/sec ±0.83% (83 runs sampled)
undici - pipeline x 5,605 ops/sec ±2.56% (81 runs sampled)
undici - request x 6,178 ops/sec ±1.46% (81 runs sampled)
undici - pool - request - multiple sockets x 6,138 ops/sec ±1.07% (82 runs sampled)
undici - stream x 6,500 ops/sec ±0.93% (83 runs sampled)
undici - dispatch x 6,894 ops/sec ±0.72% (82 runs sampled)
undici - noop x 7,038 ops/sec ±0.57% (83 runs sampled)
root@467caf9088f0:/undici# 

@codecov-io
Copy link

codecov-io commented Apr 12, 2021

Codecov Report

Merging #729 (241be32) into main (f6f229b) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #729   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           24        24           
  Lines         1874      1886   +12     
=========================================
+ Hits          1874      1886   +12     
Impacted Files Coverage Δ
lib/core/symbols.js 100.00% <ø> (ø)
lib/client.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f6f229b...241be32. Read the comment docs.

@ronag
Copy link
Member Author

ronag commented Apr 12, 2021

Interestingly enough the perf gain is negligable. Even though clinic flame blames setTimeout.

Not quite sure how think about this. @mcollina wdyt?

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina
Copy link
Member

How does the before/after flamegraph look like?

@ronag
Copy link
Member Author

ronag commented Apr 12, 2021

How does the before/after flamegraph look like?

What's the best way to share that?

@mcollina
Copy link
Member

zip them and attach them to the issue

@ronag ronag requested a review from dnlup April 12, 2021 21:17
@ronag
Copy link
Member Author

ronag commented Apr 12, 2021

Posting clinic data soon. But now I think this PR makes sense regardless whether it improves perf or not.

@ronag
Copy link
Member Author

ronag commented Apr 12, 2021

Archive.zip

70439 main
68510 pr

@mcollina

@ronag ronag merged commit bd5b0bb into main Apr 13, 2021
@ronag ronag deleted the reuse-timers branch April 25, 2021 22:22
crysmags pushed a commit to crysmags/undici that referenced this pull request Feb 27, 2024
* perf: try to re-use timer when possible

* fixup

* fixup

* fixup

* fixup

* fixup

* fixup

* fixup

* fixup

* fixup

* fixup

* fixuP

* fixup

* fixup

* fixup

* fixup

* fixup
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.

None yet

4 participants