about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-09-07 09:31:12 -0700
committerbors <bors@rust-lang.org>2013-09-07 09:31:12 -0700
commitaa1d4ef55a1f544c245f0ef163a3292dbbb9393a (patch)
treef4a52aa062f267fba0b7be72055fe238d4b7ae07 /src/rustllvm/RustWrapper.cpp
parent124eb2119c78651cfaaa7a046a101fa2e20f83ca (diff)
parent739df232fee368727f9dab5638937935981f666d (diff)
downloadrust-aa1d4ef55a1f544c245f0ef163a3292dbbb9393a.tar.gz
rust-aa1d4ef55a1f544c245f0ef163a3292dbbb9393a.zip
auto merge of #9032 : alexcrichton/rust/inline-repr, r=thestinger
This allows cross-crate inlining which is *very* good because this is called a
lot throughout libstd (even when libstd is inlined across crates).

In one of my projects, I have a test case with the following performance characteristics

commit | optimization level | runtime (seconds)
----|------|----
before | O2  | 22s
before | O3  | 107s
after | O2  | 13s
after | O3  | 12s

I'm a bit disturbed by the 107s runtime from O3 before this commit. The performance characteristics of this test involve doing an absurd amount of small operations. A huge portion of this is creating hashmaps which involves allocating vectors.

The worst portions of the profile are:
![screen shot 2013-09-06 at 10 32 15 pm](https://f.cloud.github.com/assets/64996/1100723/e5e8744c-177e-11e3-83fc-ddc5f18c60f9.png)

Which as you can see looks like some *serious* problems with inlining. I would expect the hash map methods to be high up in the profile, but the top 9 callers of `cast::transmute_copy` were `Repr::repr`'s various monomorphized instances.

I wish there we a better way to detect things like this in the future, and it's unfortunate that this is required for performance in the first place. I suppose I'm not entirely sure why this is needed because all of the methods should have been generated in-crate (monomorphized versions of library functions), so they should have gotten inlined? It also could just be that by modifying LLVM's idea of the inline cost of this function it was able to inline it in many more locations.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions