Closed
Description
https://github.com/niklasf/shakmaty/blob/master/benches/benches.rs are showing a major performance regression going from arravec 0.6.0 to 0.6.1. For example:
bench_shallow_perft
Instructions: 31844284 (+153.8268%)
L1 Accesses: 54897187 (+233.5472%)
L2 Accesses: 315 (+47.19626%)
RAM Accesses: 472 (+8.505747%)
Estimated Cycles: 54915282 (+233.3271%)
I bisected it to 5ad4687 as the first bad commit.
The benchmarks are mostly using ArrayVec::{new,push,retain}()
. So far I did not manage to reduce it further.
Activity
avoid arrayvec 0.6.1 for now (bluss/arrayvec#182)
bluss commentedon Mar 29, 2021
That's unfortunate, it's not possible to just revert that change either. More examination is needed. Would be great if it was just a matter of
#[inline]
, but potentially not(?) (Edit: I have ruled out inlining)bluss commentedon Mar 29, 2021
Maybe we'll just revert new, add a new_const constructor (both stable) and publish 0.7.0.
rodrimati1992 commentedon Mar 29, 2021
The compiler is emitting code for initializing the array of MaybeUninit (even though it doesn't need to):
https://rust.godbolt.org/z/5e1o53q9a
Reported here: rust-lang/rust#83657
bluss commentedon Mar 29, 2021
Thanks
bluss commentedon Mar 29, 2021
Because the 0.6 version was so new, it is a rather small cost to release 0.7 immediately to fix this, not so much installed base to bother with the upgrade. So thanks for flagging this so quickly, too.
bluss commentedon Mar 29, 2021
@niklasf If you have this info, how was the performance of arrayvec 0.6.0 or 0.7.0 compared with the previous version 0.5.2, any changes?
niklasf commentedon Mar 30, 2021
Thanks for handling this so quickly.
0.5.2 to 0.7.0 is a slight improvement (possibly within noise limits). For example, the benchmark that flagged this issue:
bluss commentedon Mar 30, 2021
Your retain improvement is also in 0.7. Release note will be updated with that.
Use arrayvec 0.7 to avoid perf regression in 0.6.1
Merge #8346
5 remaining items