Skip to content

Performance regression in 0.6.1 #182

Closed
@niklasf

Description

@niklasf

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

bluss

bluss commented on Mar 29, 2021

@bluss
Owner

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

bluss commented on Mar 29, 2021

@bluss
Owner

Maybe we'll just revert new, add a new_const constructor (both stable) and publish 0.7.0.

rodrimati1992

rodrimati1992 commented on Mar 29, 2021

@rodrimati1992
Contributor

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

bluss commented on Mar 29, 2021

@bluss
Owner

Thanks

bluss

bluss commented on Mar 29, 2021

@bluss
Owner

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

bluss commented on Mar 29, 2021

@bluss
Owner

@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

niklasf commented on Mar 30, 2021

@niklasf
ContributorAuthor

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:

bench_shallow_perft
  Instructions:            12345813 (-0.052298%)
  L1 Accesses:             16236361 (-0.309209%)
  L2 Accesses:                  121 (-33.51648%)
  RAM Accesses:                 431 (-2.927928%)
  Estimated Cycles:        16252051 (-0.313559%)
bluss

bluss commented on Mar 30, 2021

@bluss
Owner

Your retain improvement is also in 0.7. Release note will be updated with that.

5 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @niklasf@bluss@rodrimati1992

      Issue actions

        Performance regression in 0.6.1 · Issue #182 · bluss/arrayvec