-
-
Notifications
You must be signed in to change notification settings - Fork 160
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
fix: Remove abandoned im
crate in favor of Arc::make_mut
#305
Conversation
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.
Arc::make_mut
is a strange magical api
NOTE: Please don’t merge yet. There were concerns about the performance, and I would like to measure the impact first. There are some benchmarks in #306 |
The benchmarks so far test the scope with tags and breadcrumbs in a few situations: * inactive client, * active client, only scope manipulation * active client, scope and capturing messages The Benchmarks also allow measuring the "minimal API" mode, which basically removes the complete implementation at compile time. Measurements on my system are: Minimal API (compile-time noop): ~2.6ns Tags: * inactive: 66ns * active: 26us * capture: 53us Breadcrumbs: * inactive: 2us * active: 52us * capture: 88us
Okay, I re-ran the benchmarks and get these results: Tags:
Breadcrumbs:
So at least with the testcase (relatively few [10-30] tags in the hashmap), we even get a nice speedup. Interesting that the hashmap testcase is sped up, but it kind of makes sense, since immutable hashmaps use buckets (I think 32 elements maybe?) so with a small number of tags they don’t win us anything. I think the number of k/v pairs should be fairly small usually, but I can also create another test with a higher number. For the breadcrumbs, the testcase runs into the default |
With a populated outer scope, do a few nested `with_scope` calls and add tags / breadcrumbs in those. Perf numbers are similar to before: -8% for tags (speedup) and +2% for breadcrumbs, so quite negligible.
This incurs a lot more cloning when using lots of scopes and breadcrumbs for example.
fixes #258