-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Using retain() on a vector a lot slower in version 1.38.0 than 1.36.0 #65970
Comments
Performance of this code in 1.37 is similar to that in 1.36, so this would appear to be a regression in 1.38.
|
Minimal example: https://godbolt.org/z/f81qSU |
Could you check against nightly compiler? |
In the nightly version it takes about the same time as in stable. |
stable is Rust 1.38.0? |
yes, stable is 1.38.0. |
Will this ever be fixed or looked at? I understand that the devs may have too much work and too little help, I wish I had the knowledge to help, just sincerely asking. |
I bet it's fallout from upgrade to LLVM 9 but bisecting it would greatly help (either manually or with https://github.com/rust-lang/cargo-bisect-rustc/blob/master/TUTORIAL.md). |
Restore original implementation of Vec::retain This PR reverts rust-lang#48065, which aimed to optimize `Vec::retain` by making use of `Vec::drain_filter`. Unfortunately at that time, `drain_filter` was unsound. The soundness hole in `Vec::drain_filter` was fixed in rust-lang#61224 by guaranteeing that cleanup logic runs via a nested `Drop`, even in the event of a panic. Implementing this nested drop affects codegen (apparently?) and results in slower code. Fixes rust-lang#65970
I posted this on stackoverflow.
What happens is that when using retain over a vector, it seems to be a lot slower in version 1.38.0.
host is: x86_64-unknown-linux-gpu (according to rustc--version --verbose) and LLVM version is 8.0.
I'm using ubuntu 19.04.
As I wrote on SO, I tried:
And changed between versions with
rustup default 1.36.0
andrustup default stable
, having updated rust before withrustup update
.p.s.: From my complete program I also noticed that version 1.38.0 was still a little bit slower without using retain(). But the difference was minimal (~5%) and hard to come up with another culprit.
The text was updated successfully, but these errors were encountered: