collections: dramatically speed up Vec::reserve with magic#19574
collections: dramatically speed up Vec::reserve with magic#19574bors merged 1 commit intorust-lang:masterfrom
Conversation
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.
|
cc @thestinger or @eddyb if you want to investigate this |
!!! |
|
I say we land it. I suspect the gains will be markedly lower than advertised, but the code reads nicer anyway. :) |
|
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. |
|
I didn't see any noticeable difference in build time between this and master: My build times have always been around or below 30 minutes (without using We could still merge this and see if there's any change on the bots. (or we could check it on the |
|
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. |
(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.
(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.