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

use a single map in the incoming streams map #2890

Merged
merged 1 commit into from
Dec 5, 2020

Conversation

marten-seemann
Copy link
Member

Turns out that map access are not free if you do them in large numbers:

❯ benchstat old.txt new.txt                          
name                              old time/op  new time/op  delta
StreamsMap5000Stream0Closed-16    41.5ns ± 5%  39.8ns ± 2%   -4.11%  (p=0.000 n=15+15)
StreamsMap1000Stream0Closed-16    37.7ns ± 5%  33.8ns ± 2%  -10.45%  (p=0.000 n=13+15)
StreamsMap1000Stream10Closed-16   47.9ns ± 9%  35.1ns ± 7%  -26.88%  (p=0.000 n=16+16)
StreamsMap1000Stream600Closed-16  41.5ns ± 7%  32.9ns ±15%  -20.71%  (p=0.000 n=16+16)
StreamsMap1000Stream900Closed-16  37.3ns ± 6%  32.5ns ± 5%  -12.94%  (p=0.000 n=16+15)
StreamsMap100Stream0Closed-16     29.0ns ± 2%  27.3ns ± 8%   -5.97%  (p=0.000 n=15+16)
StreamsMap100Stream10Closed-16    43.8ns ± 9%  27.9ns ± 8%  -36.24%  (p=0.000 n=16+16)
StreamsMap100Stream60Closed-16    33.3ns ± 9%  28.2ns ± 8%  -15.18%  (p=0.000 n=16+16)
StreamsMap100Stream90Closed-16    27.9ns ± 2%  29.0ns ± 7%     ~     (p=0.090 n=15+16)
StreamsMap30Stream0Closed-16      28.4ns ± 2%  26.9ns ± 2%   -5.30%  (p=0.000 n=16+16)
StreamsMap30Stream5Closed-16      33.9ns ± 9%  29.5ns ±14%  -12.98%  (p=0.000 n=16+16)

@codecov
Copy link

codecov bot commented Nov 21, 2020

Codecov Report

Merging #2890 (0b26740) into master (69158cf) will not change coverage.
The diff coverage is 93.33%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2890   +/-   ##
=======================================
  Coverage   85.77%   85.77%           
=======================================
  Files         133      133           
  Lines        9187     9187           
=======================================
  Hits         7880     7880           
  Misses        959      959           
  Partials      348      348           
Impacted Files Coverage Δ
streams_map_incoming_generic.go 92.22% <93.33%> (ø)

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 69158cf...0b26740. Read the comment docs.

@marten-seemann marten-seemann merged commit 5ff2222 into master Dec 5, 2020
@marten-seemann marten-seemann deleted the optimize-incoming-streams-map-map-access branch December 6, 2020 02:51
@aschmahmann aschmahmann mentioned this pull request May 14, 2021
71 tasks
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.

2 participants