Most performant usage?
Bajix opened this issue · comments
Is either of once_cell::race::OnceBox
or once_cell::sync::Lazy
ever more performant than once_cell::sync::OnceCell
?
Lazy is just a thin wrapper over OnceCell, it should behave the same way.
race::OnceCell is interesting: during initialization, it doesn’t block and is immune to priority inversion problem. I am not sure if that translates into a real perf difference.
On get (the hot path) all versions do an Acquire load, so I’d expect them to behave roughly the same.
Ah I see that's very helpful. If all are equal during get, then the convenience of Lazy really stands out. I'll have to update diesel-connection to use Lazy here just for the sake of simplicity.