Crates / Compare / once_cell vs lazy_static
Rust crates side by side · data Oct 24, 2026
once_cell vs lazy_static
Short answerBoth are now in std: OnceLock since Rust 1.70 and LazyLock since 1.80. Prefer std, then once_cell. By steady daily use, once_cell is bigger: 3,785,180 real downloads a day against 2,449,997 for lazy_static (1.5x). 8,656 crates depend on once_cell and 10,953 on lazy_static. once_cell last shipped 7 months ago, lazy_static 23 days ago.
once_cell
Widely usedWidely used and steady.
8,656 crates depend on it; no release in the last 90 days, so its count is all steady use.
Single assignment cells and lazy values.
lazy_static
FoundationalFoundational and steady.
10,953 crates depend on it; downloads jump on release days (1.3x the baseline).
A macro for declaring lazily evaluated statics in Rust.
once_celllazy_static · 100% = that crate's normal quiet day, so a spike to 300% is triple its usual traffic
Every number, side by side
| Same window, same method | once_cell | lazy_static |
|---|---|---|
| Real downloads a day | 3,785,180 | 2,449,997 |
| Crates that depend on it | 8,656 | 10,953 |
| Last release | 1.21.4, 7 months ago | 1.5.1, 23 days ago |
| Trend vs the field | -1% | +4% |
| Release-window share | 0.0% | 2.8% |
| Downloads in the window | 336,233,853 | 226,380,088 |
| All-time downloads | 1,416,715,677 | 1,095,056,506 |
| Versions published | 67 | 39 |
| License | MIT OR Apache-2.0 | MIT OR Apache-2.0 |
| MSRV | 1.65 | not set |
| First published | Aug 2, 2018 | Nov 23, 2014 |
Which to pick
- Pick once_cell if you are on a Rust older than 1.80 and need lazy statics today.
- Pick lazy_static if only in existing code; for new code use the standard library.
- Bottom line: Both are now in std: OnceLock since Rust 1.70 and LazyLock since 1.80. Prefer std, then once_cell. (checked against each project's docs, Oct 24, 2026)
- Downloads tell you what is common, not what fits. Each crate's own description above says what it is for; when the jobs differ, pick by the job.
- When both fit, prefer the one more crates depend on (lazy_static, 10,953 dependents): more eyes, more answered questions, and you may already have it in your tree.
- Check the release dates against your own pace: once_cell 7 months ago, lazy_static 23 days ago.
Also in this space
Method
Real downloads = the median day with no release that day or the day before, from the crates.io API (Jul 27, 2026 to Oct 23, 2026). Raw crates.io counts include CI and bots and run high (why); the method is from our 90-day study. People search for this pair: Google suggests "once_cell vs lazy_static".