Skip to content

performance regression introduced in nightly-2018-11-04 #56592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tomcraven opened this issue Dec 7, 2018 · 1 comment
Closed

performance regression introduced in nightly-2018-11-04 #56592

tomcraven opened this issue Dec 7, 2018 · 1 comment

Comments

@tomcraven
Copy link

tomcraven commented Dec 7, 2018

debugging a performance regression in my code, found it was introduced between nightly-2018-11-03 and nightly-2018-11-04 - 8b09631...04fdb44

the best minimum example i could come up with:

    #[bench]
    fn bench_something(b: &mut Bencher) {
        b.iter(|| {
            (0..1000)
                .for_each(|a| {
                    let mut vec = Vec::with_capacity(10);
                    vec.push(0);
                    vec.push(0);
                    vec.push(0);
                    vec.push(0);
                    vec.push(0);
                    vec.push(0);
                    vec.push(0);
                    vec.push(0);
                    vec.push(0);
                    vec.push(0);
                })
        });
    }

test between the two versions:

$ rustup override set nightly-2018-11-03 && cargo bench something && rustup override set nightly-2018-11-04 && cargo bench something
info: using existing install for 'nightly-2018-11-03-x86_64-apple-darwin'
info: override toolchain for '<redacted>' set to 'nightly-2018-11-03-x86_64-apple-darwin'
  nightly-2018-11-03-x86_64-apple-darwin unchanged - rustc 1.32.0-nightly (8b096314a 2018-11-02)
    Finished release [optimized] target(s) in 1.27s
     Running target/release/deps/<redacted>-08b08ca17f1f5108
running 1 test
test benchmarks::bench_something                                        ... bench:      27,958 ns/iter (+/- 3,807)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured; 80 filtered out
info: using existing install for 'nightly-2018-11-04-x86_64-apple-darwin'
info: override toolchain for '<redacted>' set to 'nightly-2018-11-04-x86_64-apple-darwin'
  nightly-2018-11-04-x86_64-apple-darwin unchanged - rustc 1.32.0-nightly (04fdb44f5 2018-11-03)
    Finished release [optimized] target(s) in 1.25s
     Running target/release/deps/<redacted>-307045d1760e56ff
running 1 test
test benchmarks::bench_something                                        ... bench:      75,034 ns/iter (+/- 16,036)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured; 80 filtered out

and same results for current nightly:

$ rustup override set nightly
info: using existing install for 'nightly-x86_64-apple-darwin'
info: override toolchain for '<redacted>' set to 'nightly-x86_64-apple-darwin'
  nightly-x86_64-apple-darwin unchanged - rustc 1.32.0-nightly (14997d56a 2018-12-05)

$ cargo bench something
    Finished release [optimized] target(s) in 0.25s
     Running target/release/deps/<redacted>-bda65b0f58ecd966
running 1 test
test benchmarks::bench_something                                        ... bench:      78,035 ns/iter (+/- 14,081)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured; 80 filtered out
@nikic
Copy link
Contributor

nikic commented Dec 7, 2018

In this nightly the default allocator was switched from jemalloc to the system allocator. It is expected that this may lead to performance regressions in some cases. See also #56283 for a similar report and in particular the comment #56283 (comment) showing how you can explicitly enable jemalloc again.

@nikic nikic closed this as completed Dec 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants