-
Notifications
You must be signed in to change notification settings - Fork 389
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
test(tm2/pkg/cmap): add benchmarks to show true impact of contention #3540
base: master
Are you sure you want to change the base?
test(tm2/pkg/cmap): add benchmarks to show true impact of contention #3540
Conversation
🛠 PR Checks SummaryAll Automated Checks passed. ✅ Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):🟢 Maintainers must be able to edit this pull request (more info) ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
@odeke-em , can you resolve the CI check error for "TM2 / Run TM2 suite / Go Lint" ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good overall
tm2/pkg/cmap/cmap_test.go
Outdated
close(semaCh) | ||
wg.Wait() | ||
|
||
sink = wg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why put sink = wg
here?
does it not maybe make sense to put a sink
in the goroutine function, and use that as a sink for assigning the values from size, keys and values, rather than using the blank ident?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That becomes a data race then which is definitely not something we want, I am how going to set it to semaCh
e05a9cc
to
dba0590
Compare
The Go standard library's sync.Map is touted as great for cases with high load and is commonly known knowledge but the benchmark that I am committing shows otherwise that for this library's usage, it is so much more expensive hence this benchmark will avoid someone committing sync.Map without seeing the true implications. ```shell $ benchstat map_w_mutex.txt stdlib_sync_map.txt name old time/op new time/op delta CMapConcurrentInsertsDeletesHas-8 1.72s ±11% 1.92s ± 3% +11.66% (p=0.000 n=10+9) CMapHas-8 109ns ± 9% 118ns ± 3% +8.26% (p=0.002 n=10+8) name old alloc/op new alloc/op delta CMapConcurrentInsertsDeletesHas-8 1.18GB ± 2% 3.21GB ± 3% +172.09% (p=0.000 n=10+10) CMapHas-8 16.0B ± 0% 16.0B ± 0% ~ (all equal) name old allocs/op new allocs/op delta CMapConcurrentInsertsDeletesHas-8 824k ± 0% 4433k ± 0% +437.89% (p=0.000 n=10+10) CMapHas-8 2.00 ± 0% 1.60 ±38% ~ (p=0.065 n=9+10) ``` Updates gnolang#3505
dba0590
to
4820bc8
Compare
The Go standard library's sync.Map is touted as great for cases with high load and is commonly known knowledge but the benchmark that I am committing shows otherwise that for this library's usage, it is so much more expensive hence this benchmark will avoid someone committing sync.Map without seeing the true implications.
Updates #3505