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

replace the RWMutex with a Mutex in the packet handler map #2864

Merged
merged 1 commit into from Nov 11, 2020

Conversation

marten-seemann
Copy link
Member

Using an RWMutex only makes sense if reads handle in parallel. They don't in this case.

Locking and unlocking of a Mutex is significantly faster than of a Mutex:

BenchmarkMutex-16       100000000               11.8 ns/op             0 B/op          0 allocs/op
BenchmarkRWMutex-16     58777676                21.0 ns/op             0 B/op          0 allocs/op

@codecov
Copy link

codecov bot commented Nov 6, 2020

Codecov Report

Merging #2864 into master will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2864      +/-   ##
==========================================
- Coverage   85.67%   85.67%   -0.00%     
==========================================
  Files         134      134              
  Lines        9087     9086       -1     
==========================================
- Hits         7785     7784       -1     
  Misses        960      960              
  Partials      342      342              
Impacted Files Coverage Δ
packet_handler_map.go 73.02% <100.00%> (-0.12%) ⬇️

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 272229a...ba37b0e. Read the comment docs.

@marten-seemann marten-seemann merged commit 0bd10a6 into master Nov 11, 2020
@marten-seemann marten-seemann deleted the packet-handler-map-mutex-type branch November 11, 2020 09:25
@aschmahmann aschmahmann mentioned this pull request Feb 18, 2021
73 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.

None yet

2 participants