logos icon indicating copy to clipboard operation
logos copied to clipboard

chore: move `lazy_static` to `once_cell`, and some clippy fix

Open attila-lin opened this issue 2 years ago • 11 comments

attila-lin avatar Feb 20 '24 06:02 attila-lin

Hello @attila-lin, could you please provide some motivation why changes from lazy_static to once_cell`?

Also, I assume you ran Clippy with the Nightly toolchain?

jeertmans avatar Feb 20 '24 08:02 jeertmans

Hello @attila-lin, could you please provide some motivation why changes from lazy_static to once_cell`?

maintenance = { status = "passively-maintained" }

this crate is passively-maintained. The std choose the once_cell impl.

Also, I assume you ran Clippy with the Nightly toolchain?

Yes.

attila-lin avatar Feb 21 '24 03:02 attila-lin

Hello @attila-lin, could you please provide some motivation why changes from lazy_static to once_cell`?

maintenance = { status = "passively-maintained" }

this crate is passively-maintained. The std choose the once_cell impl.

The fact that it is passively maintained is not an issue to me, but the second argument looks ok. But I assume we would go for std::cell::LazyCell once https://github.com/rust-lang/rust/issues/109736 is merged (so stabilized).

Also, I assume you ran Clippy with the Nightly toolchain?

Yes.

Fair enough

jeertmans avatar Feb 21 '24 09:02 jeertmans

Benchmarks show a large decreasing in performances, which is surprising:

group                                         before                                 changes
-----                                         ------                                 -------
count_ok/identifiers                          1.06    866.3±5.20ns   857.6 MB/sec    1.00   818.1±20.90ns   908.1 MB/sec
count_ok/keywords_operators_and_punctators    1.00      2.5±0.05µs   805.5 MB/sec    1.02      2.6±0.04µs   790.1 MB/sec
count_ok/strings                              1.00   554.8±12.18ns  1497.3 MB/sec    1.24   689.4±33.73ns  1204.9 MB/sec
iterate/identifiers                           1.02   869.3±19.49ns   854.6 MB/sec    1.00    850.5±4.32ns   873.5 MB/sec
iterate/keywords_operators_and_punctators     1.05      2.7±0.02µs   762.7 MB/sec    1.00      2.5±0.02µs   799.9 MB/sec
iterate/strings                               1.00   585.3±21.16ns  1419.1 MB/sec    1.22   716.3±23.00ns  1159.6 MB/sec

I just restarted the benchmarks, to see if that stays the same.

jeertmans avatar Feb 21 '24 09:02 jeertmans

interesting!

attila-lin avatar Feb 21 '24 12:02 attila-lin

This is very surprising... Do you observe the same benchmark changes locally?

jeertmans avatar Feb 21 '24 13:02 jeertmans

let me try unsync version!

attila-lin avatar Apr 04 '24 01:04 attila-lin

Any update @attila-lin?

jeertmans avatar Jul 23 '24 12:07 jeertmans