lazy_static is host to a number of bad design patterns. Namely, any other crate in the dependency graph can force lazy_static to fall back on a spinlock-oriented approach through feature unification. In addition, it uses an opaque macro, static mut, and overall takes longer to compile than once_cell. The Rust ecosystem as a whole is migrating to once_cell to avoid these design flaws.
As this crate is depended on by ahash which, in turn, is depended on by many other crates in the Rust ecosystem, it would be beneficial if it no longer depended on lazy_static. In fact, for one of my projects, it is the only time lazy_static appears in the dependency graph. This crate replaces the one time that lazy_static is used, storing and caching the RNG seed, with a once_cell::sync::Lazy.
lazy_static
is host to a number of bad design patterns. Namely, any other crate in the dependency graph can forcelazy_static
to fall back on a spinlock-oriented approach through feature unification. In addition, it uses an opaque macro,static mut
, and overall takes longer to compile thanonce_cell
. The Rust ecosystem as a whole is migrating toonce_cell
to avoid these design flaws.As this crate is depended on by
ahash
which, in turn, is depended on by many other crates in the Rust ecosystem, it would be beneficial if it no longer depended onlazy_static
. In fact, for one of my projects, it is the only timelazy_static
appears in the dependency graph. This crate replaces the one time thatlazy_static
is used, storing and caching the RNG seed, with aonce_cell::sync::Lazy
.