It also has wider API, for example, non-thread-safe lazy.
In addition to that, the perf effects of lazy values are really hard to measure. Will it be performant? Probably yes, until the branch prediction will be unable to predict it for too many branches. Will parameters be faster? Maybe, but they may cause pressure on the register allocator which is very hard to benchmark, and tend to only show in real-world programs.
Looks nice.
However, don't use
lazy_static
today. Useonce_cell
, as it's going to be integrated intostd
. Also it seems like it's faster?.It also has wider API, for example, non-thread-safe lazy.
In addition to that, the perf effects of lazy values are really hard to measure. Will it be performant? Probably yes, until the branch prediction will be unable to predict it for too many branches. Will parameters be faster? Maybe, but they may cause pressure on the register allocator which is very hard to benchmark, and tend to only show in real-world programs.
Thanks Chayim! I updated the post with your comment.