#[cold] attribute does is not propagated across crates #64075
Open
Description
opened on Sep 1, 2019
Hi!
When hacking on once_cell
, I've noticed that it is significantly faster than lazy_static
. Digging into this, it seems like the difference is in the usage of the #[cold]
attribute.
Specifically, I've applied a patch which marks initialization function as #[cold]
in lazy_static, and it indeed improved perf quite a bunch:
matklad/lazy-static.rs@7863cc0
And this is really weird, because Once
, which powers lazy_static
, already has the #[cold]
attribute. Seems like it doesn't take an effect for whatever reason?
@rustbot modify labels to: +I-slow
Activity