]> git.lizzy.rs Git - rust.git/commit
Auto merge of #51833 - wesleywiser:faster_large_constant_arrays, r=oli-obk
authorbors <bors@rust-lang.org>
Sun, 1 Jul 2018 18:43:41 +0000 (18:43 +0000)
committerbors <bors@rust-lang.org>
Sun, 1 Jul 2018 18:43:41 +0000 (18:43 +0000)
commita2be769fd50403a07c45677f8f285491c8e90d74
tree898d003c54271e6be9ca89de25668091d9f3336d
parent6af9f91a170d33550e8f5922cdb728384ec9c7eb
parent46512e09c9f97a68a36e2d72e3be766b1e76a1a0
Auto merge of #51833 - wesleywiser:faster_large_constant_arrays, r=oli-obk

Speed up compilation of large constant arrays

This is a different approach to #51672 as suggested by @oli-obk. Rather
than write each repeated value one-by-one, we write the first one and
then copy its value directly into the remaining memory.

With this change, the [toy program](https://github.com/rust-lang/rust/blob/c2f4744d2db4e162df824d0bd0b093ba4b351545/src/test/run-pass/mir_heavy_promoted.rs) goes from 63 seconds to 19 seconds on my machine.

Edit: Inlining `Size::bytes()` saves an additional 6 seconds dropping the total time to 13 seconds on my machine.

Edit2: Now down to 2.8 seconds.

r? @oli-obk

cc @nnethercote @eddyb
src/librustc/mir/interpret/mod.rs
src/librustc_mir/interpret/eval_context.rs
src/librustc_mir/interpret/memory.rs