-
Notifications
You must be signed in to change notification settings - Fork 39
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
Low/Minimal Allocation version of tracing_tracy #42
Comments
So, while
I had in the past experimented with an idea of making |
One thing to note: by default
I wonder if we should flip the default here. Noticing that callstacks are desired, and then finding documentation on how to enable it seems like it would make it much easier to document this performance tradeoff, than realizing that you need to disable callstacks if you want more performant tracing. |
And then benchmarking the
So it does indeed seem like majority of the overhead is in the implementation of the |
MessagesHere's a profile for messages with callstacks disabled. One thing that figures somewhat prominently (~17% of the runtime) in the profile is this rust_tracy_client/tracing-tracy/src/lib.rs Lines 228 to 234 in a4cb0d1
This allocation is used to construct and format the message. In theory for simple events that only ever specify a There's also a bunch of time (~32%) being spent just formatting the message and field. Here we must pick between whether we want more information in the events being sent out or whether we'd rather make them go faster. This seems like it could be configurable in the subscriber. Finally the remaining chunk is 40% in tracy itself which we can do nothing about. Summa summarum SpansHere's a profile for spans with callstacks and fibers disabled. Overall I went ahead and submitted #43 and #44 which should improve the situation here substantially, but I won't have any resources in the foreseeable future to make any significant changes to the structure or the architecture here. |
tokio-rs/tracing#428 will soon be the last remaining item here. |
Tracing side of things will be fixed by tokio-rs/tracing#2840 |
So I think this is pretty much fixed on the tracy side once #87 goes through. |
Thanks for the effort! This work has been released to crates.io |
🤩 |
We've been extensively using
tracing_tracy
to profile and optimize bevy. However, one potential pain point with our usage of the crate is the overhead incurred when entering a span. This has been reported in bevyengine/bevy#4892, where I'm seeing ~10us of overhead per span. Using these in tight loops artificially inflates the size of the surrounding span and is leading to inaccurate measurements.@davidbarsky suggested that it might be a good idea to write a
tracing
subscriber instead of a Layer usingsharded_slab
and caching the allocation keys in the span instead of using extensions.The text was updated successfully, but these errors were encountered: