hawkw / sharded-slab

a lock-free concurrent slab (experimental)
MIT License
273 stars 19 forks source link

Migrate from lazy_static to once_cell #71

Open james7132 opened 2 years ago

james7132 commented 2 years ago

lazy_static involves macros, takes a bit longer to compile, and once_cell provides more flexible ways on the way to being added to std. Replace all usages of lazy_static with static VAR: Lazy<T>.

One potential drawback is that lazy_static supports spin-waiting on the result, while Lazy doesn't. I don't think any of the crate's usages are perf-bound by this though.

notgull commented 2 years ago

The spin crate supports spinning on the result with a spin::OnceCell, which you can use on a feature flag.