-
Notifications
You must be signed in to change notification settings - Fork 791
tracing_core::dispatcher is repeatedly monomorphised in the downstream crate #783
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
Comments
Thanks for bringing this to our attention! I did some preliminary digging, I fully expect that @hawkw will correct me :) I suspect that the
If the monomorphized code is coming from the macros, I'm not entirely sure how to change that at the moment; I think Eliza will be able to say with greater confidence as to what's up. In the meantime, I'm going to try to swap out |
Over Zulip, @matklad told me:
|
Ah, yup, this is because all the invocations are inside a macro. It seems like a potential solution to this would be to have a function like fn is_enabled(meta: &Metadata<_>) -> bool {
dispatcher::get_default(|current| current.enabled(meta)
} for the most common monomorphizations that occur inside the macros. That way, the same closure is only monomorphized once inside of This should actually be a pretty simple fix, so we can try it out and see if it has a significant impact on compile times. |
(meta: sorry for ignoring the template, I just want to quickly pen down an observation, feel free to ignore the issue!)
In rust-analyzer, I've noticed that tracing is pretty "hot" in terms of
cargo llvm-lines
. For our type-checking code I get:Three points of interest here:
Note that rust-analyzer doesn't use tracing directly itself, it comes from
chalk
I believe (but impacts our compile times, and not chalk compile times, due to the last bullet).The text was updated successfully, but these errors were encountered: