Skip to content

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

Merged
bors merged 1 commit into
rust-lang:masterfrom
erickt:vec-reserve
Dec 8, 2014
Merged

collections: dramatically speed up Vec::reserve with magic#19574
bors merged 1 commit into
rust-lang:masterfrom
erickt:vec-reserve

Conversation

@erickt

@erickt erickt commented Dec 5, 2014

Copy link
Copy Markdown
Contributor

(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

pcwalton commented Dec 5, 2014

Copy link
Copy Markdown
Contributor

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

@aturon

aturon commented Dec 5, 2014

Copy link
Copy Markdown
Contributor

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

!!!

@nikomatsakis

Copy link
Copy Markdown
Contributor

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

@bstrie

bstrie commented Dec 5, 2014

Copy link
Copy Markdown
Contributor

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

japaric commented Dec 5, 2014

Copy link
Copy Markdown
Contributor

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

erickt commented Dec 5, 2014

Copy link
Copy Markdown
Contributor Author

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