-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Performance regression with nightly benchmarks. #47062
Comments
Commit range: 0077d12...77efd68 |
Also maybe #46537 but it is supposed to be off by default. |
This bug looks very much like #46923 and #46897 , both of which are fixed on rustc 1.24.0-nightly (1abeb43 2017-12-27). @pitdicker can you check whether the issue still reproduces? |
It can't be #46701 unless |
I'm tagging this as a regression (it seems to be?) |
Sorry for the late reply. This assembly happens to be from the I did it a bit naïve: the assembly is copied from |
@pitdicker Is it possible to make a small, standalone example? That would no doubt be very helpful. I'm going to call this P-high, but I'm not sure who to assign it to. |
triage: P-high |
Does this count as 'small, standalone'? #[bench]
fn tiny_xorshift(b: &mut Bencher) {
let mut y = 2463534242u32;
b.bytes = 4 * 1000;
b.iter(|| {
for _ in 0..1000 {
y ^= y << 13;
y ^= y >> 17;
y ^= y << 5;
black_box(y);
}
});
} Before:
After:
It has the same regression without the extra loop, but runs too fast to measure well: #[bench]
fn tiny_xorshift(b: &mut Bencher) {
let mut y = 2463534242u32;
b.bytes = 4;
b.iter(|| {
y ^= y << 13;
y ^= y >> 17;
y ^= y << 5;
black_box(y);
});
} |
I tried reproducing without the bench harness and I ended up at this, which doesn't repro: #![crate_type = "lib"]
#![feature(test)]
extern crate test;
pub fn tiny_xorshift() {
let mut y = 2463534242u32;
let mut f = || {
for _ in 0..1000 {
y ^= y << 13;
y ^= y >> 17;
y ^= y << 5;
test::black_box(y);
}
};
for _ in 0..1000 {
f();
}
} @pitdicker This is a pretty simple benchmark, so I'm wondering, is the bench harness regressed? |
#46623 doesn't affect the code being benchmarked directly, but it does make the LLVM IR different enough that it's hard to distinguish any one specific change. Locally I get these results:
EDIT: @nagisa pointed out that we started doing multiple codegen units which have an impact on top of the original regression (see #47665), obscuring the fix (for which @est31 was right AFAICT). |
Since it was merged less than 90 days ago, we should have CI artifacts on both sides of #46623 (before/after) which you could run and get numbers from. Is that what you are looking for? As to where it got fixed, well, you could either run rust-bisect since it's within 90 days or go by nightly and then run bisect or its equivalent on the PRs within that nightly commit range. Since this is a timing thing, it is probably easiest to use rust-bisect just for the install-sysroot command and use |
Great, I can confirm I get the same performance with benchmarks as before with
(but it does not sound like a great permanent solution) |
@pitdicker Right, which is why #47665 is still open - feel free to track / discuss on that issue! |
The benchmarks for
rand
and for my cratesmall-rngs
have regressed a lot with recent nightlies. A few extra branches are introduced at the end of the benchmark loop.Relevant assembly with nightly 0077d12 2017-12-14:
With nightly 77efd68 2017-12-15:
The text was updated successfully, but these errors were encountered: