winrt-rust
winrt-rust copied to clipboard
Improve compile time (or at least don't regress it)
We can use this issue to track the current compile time (and memory usage) by posting the output of cargo rustc --features all -- -Z time-passes
. Also don't forget to include rustc -V
.
Here are some numbers (for https://github.com/contextfree/winrt-rust/commit/2e914f7273f15085975b45fd77c6d908723762db) (without the time required to compile dependencies) showing the effect of https://github.com/rust-lang/rust/pull/36524 between rustc 1.13.0-nightly (c772948b6 2016-09-20)
and rustc 1.13.0-nightly (4f9812a59 2016-09-21)
:
time [secs] | rlib size [bytes] | |
---|---|---|
Before (Debug) | 351.46 | 263.572.720 |
Before (Release) | 506.68 | 154.972.432 |
After (Debug) | 285.87 | 187.843.258 |
After (Release) | 305.48 | 119.689.216 |
See details in a gist.
I added the #[inline]
attribute to more functions in https://github.com/contextfree/winrt-rust/commit/df557dd1a1c342ede680ff779110c1994d3ee966 and measured again, this time comparing rustc 1.13.0-nightly (4f9812a59 2016-09-21)
and rustc 1.13.0-nightly (d0623cf7b 2016-09-26)
time [secs] | rlib size [bytes] | |
---|---|---|
Before (Debug) | 250.86 | 99.626.880 |
Before (Release) | 259.66 | 97.387.268 |
After (Debug) | 223.87 | 76.829.116 |
After (Release) | 221.5 | 74.582.690 |
Adding more #[inline]
improved everything but the item-bodies checking
phase, and the latest compiler changes improved compile times further!
I have updated the gist to include the latest measurements.
I just did a new test run (with PR #48), and observed that the compile times slightly decreased, but the memory usage and output rlib size increased quite a bit (as always, see the gist for details):
time [secs] | rlib size [bytes] | max memory [MB] | |
---|---|---|---|
2016-09-26 (Debug) | 223.87 | 76.829.116 | 2396 |
2016-09-26 (Release) | 221.5 | 74.582.690 | 2384 |
2017-12-20 (Debug) | 214.25 | 117.216.458 | 4334 |
2017-12-20 (Release) | 215.84 | 114.618.966 | 4325 |
This can have many reasons, because both rustc
and winrt itself changed between those two measurements. Maybe worth investigating, but I don't have time for that.