Skip to content

collections: dramatically speed up Vec::reserve with magic #19574

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

Merged
merged 1 commit into from
Dec 8, 2014

Conversation

erickt
Copy link
Contributor

@erickt erickt commented Dec 5, 2014

(I don't understand why this works, and so I don't quite trust this yet. I'm pushing it up to see if anyone else can replicate this performance increase)

Somehow llvm is able to optimize this version of Vec::reserve into dramatically faster than the old version. In micro-benchmarks this was 2-10 times faster. It also reduce my Rust compile time from 41 minutes to 27 minutes.

Closes #19281.

Somehow llvm is able to optimize this version of Vec::reserve
into dramatically faster than the old version. In micro-benchmarks
this was 2-10 times faster. It also shaved 14 minutes off of
rust's compile times.

Closes rust-lang#19281.
@pcwalton
Copy link
Contributor

pcwalton commented Dec 5, 2014

cc @thestinger or @eddyb if you want to investigate this

@aturon
Copy link
Member

aturon commented Dec 5, 2014

It also reduce my Rust compile time from 41 minutes to 27 minutes.

!!!

@nikomatsakis
Copy link
Contributor

I say we land it. I suspect the gains will be markedly lower than advertised, but the code reads nicer anyway. :)

@bstrie
Copy link
Contributor

bstrie commented Dec 5, 2014

Let's land it, but let's file a bug to investigate the reasons why LLVM is so finicky here. This is too spooky to just sweep under the rug.

@japaric
Copy link
Member

japaric commented Dec 5, 2014

I didn't see any noticeable difference in build time between this and master:

# master
make -j8  2074.12s user 23.50s system 131% cpu 26:34.38 total
# This PR on top of master
make -j8  2240.88s user 25.49s system 131% cpu 28:39.00 total

(some per crate-ish times)

My build times have always been around or below 30 minutes (without using -Ccodegen_units), so this looks normal.

We could still merge this and see if there's any change on the bots. (or we could check it on the try branch first?)

@erickt
Copy link
Contributor Author

erickt commented Dec 5, 2014

Yeah, on a second build I wasn't able to get the benefit either :(. I think my without-patch build was just abnormally slow rather than this patch being abnormally fast.

bors added a commit that referenced this pull request Dec 8, 2014
(I don't understand why this works, and so I don't quite trust this yet. I'm pushing it up to see if anyone else can replicate this performance increase)

Somehow llvm is able to optimize this version of Vec::reserve into dramatically faster than the old version. In micro-benchmarks this was 2-10 times faster. It also reduce my Rust compile time from 41 minutes to 27 minutes.

Closes #19281.
@bors bors closed this Dec 8, 2014
@bors bors merged commit e20ea0b into rust-lang:master Dec 8, 2014
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

Successfully merging this pull request may close these issues.

Dramatic slowdown in rust performance from the serialization benchmarks
8 participants