once_cell by @matklad provides a neat way of initializing lazy singletons. There's a related RFC out now to add this to the stdlib.
In anticipation of this, and in order to help test it, it might be nice if we switched our code over to use once_cell from lazy-static.
Note that once_cell is also slightly faster than lazy_static (due to compiler bug?) for the hot get operation, which might actually matter for hot task switching code?
10:04:54|~/projects/once_cell|pl-tests✓
λ cargo run --release --example bench_vs_lazy_static
Compiling once_cell v1.2.0 (/home/matklad/projects/once_cell)
Finished release [optimized] target(s) in 0.39s
Running `target/release/examples/bench_vs_lazy_static`
once_cell: 486.122531ms (total time of many accesses accesses)
lazy_static: 579.513044ms
Hello, I'm interested in this. Could I give it a try?
@wusyong Of course :) thank you!
Most helpful comment
Note that
once_cellis also slightly faster thanlazy_static(due to compiler bug?) for the hot get operation, which might actually matter for hot task switching code?