Skip to content

Commit eb2fe94

Browse files
committed
Improve compile time perf section
1 parent 8d179ad commit eb2fe94

File tree

1 file changed

+42
-39
lines changed

1 file changed

+42
-39
lines changed

_posts/2017-05-15-rust-at-two-years.md

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,7 @@ aspect of Rust to improve all the time, but we don't have an infinite number of
175175
contributors with an infinite amount of time available yet!
176176

177177
Let's check in on some of the initiatives in each of the goals in the roadmap.
178-
Take a look at each goal's tracking issue for even more initiatives than we're
179-
mentioning here.
178+
The linked tracking issues give even more detail than the summaries here.
180179

181180
### [Rust should have a lower learning curve](https://github.com/rust-lang/rust-roadmap/issues/3)
182181

@@ -213,18 +212,47 @@ Also check out:
213212

214213
### [Rust should have a pleasant edit-compile-debug cycle](https://github.com/rust-lang/rust-roadmap/issues/1)
215214

216-
Compiler improvements are ongoing. This year, [MIR became a default part of the
217-
compilation process](https://github.com/rust-lang/rust/pull/34096), which was a
218-
prerequisite to unlocking further improvements.
215+
Waiting on the compiler is the biggest roadblock preventing the Rust
216+
development workflow from being described as "pleasant". So far, a lot of work
217+
has been done behind the scenes to make future improvements possible. Those
218+
improvements are starting to come to fruition, but rest assured that this
219+
initiative is far from being considered complete.
220+
221+
One of the major prerequisites to improvements was adding [MIR] (Mid-level
222+
Intermediate Representation) to the compiler pipeline. This year, [MIR became a
223+
default part of the compilation process][mir-default].
224+
225+
[MIR]: https://blog.rust-lang.org/2016/04/19/MIR.html
226+
[mir-default]: https://github.com/rust-lang/rust/pull/34096
227+
228+
Because of MIR, we're now able to work on adding incremental compilation.
229+
Nightly builds currently offer ["beta" support][incrcomp] for it, permitting
230+
the compiler to skip over code generation. We are in the midst of refactoring
231+
the compiler to support finer-grained incremental computation, allowing us to
232+
skip type-checking and other parts of compilation as well. This refactoring
233+
should also offer better support for the IDE work (see next section), since it
234+
enables the compiler to do things like compile a single function in isolation.
235+
We expect to see the next stage of incremental compilation becoming available
236+
over the next few months. If you're interested in getting involved, please
237+
check out the [roadmap issue #4][roadmap-4], which is updated periodically to
238+
reflect the current status, as well as places where help is needed.
219239

220-
Below is a table of [benchmarks] comparing the time it takes to compile a few
221-
crates and tests with Rust 1.8.0 (the stable release a year ago) to Rust 1.17.0
222-
(the stable release today). On average, compile times have improved by 5-10%,
223-
but some worst-case behavior has been fixed that results in >95% improvements
224-
in certain programs. A couple of crates did show a slight regression of 1-15%
225-
in compile times, but in most cases it's a win. The helloworld crate saw a 110%
226-
increase in compile time, but it only equates to +0.1 second, which is probably
227-
a small fixed overhead that gets overwhelmed in any larger project.
240+
*Thanks to Niko Matsakis for this incremental compilation summary!*
241+
242+
[incrcomp]: https://internals.rust-lang.org/t/incremental-compilation-beta/4721
243+
[roadmap-4]: https://github.com/rust-lang/rust-roadmap/issues/4
244+
245+
The progress that's happened in the last year on improving the time it takes to
246+
do a full compilation is mostly slow and steady, with a few pathological cases
247+
greatly improved Below is a table of [benchmarks] comparing the time it takes
248+
to compile a few crates and tests with Rust 1.8.0 (the stable release a year
249+
ago) to Rust 1.17.0 (the stable release today). On average, compile times have
250+
improved by 5-10%, but some worst-case behavior has been fixed that results
251+
in >95% improvements in certain programs. A couple of crates did show a slight
252+
regression of 1-15% in compile times, but in most cases it's a win. The
253+
helloworld crate saw a 110% increase in compile time, but it only equates to
254+
+0.1 second, which is probably a small fixed overhead that gets overwhelmed in
255+
any larger project.
228256

229257
| Benchmark | 1.8.0 (time) | 1.8.0 ([rss]) | 1.17.0 (time) | 1.17.0 ([rss]) | % change (time) | % change ([rss]) |
230258
|----------------------|--------------|---------------|---------------|----------------|-----------------|------------------|
@@ -247,37 +275,12 @@ In graph form:
247275
for analyzing it!*
248276

249277
Check out [perf.rust-lang.org] for monitoring Rust's performance day-to-day.
278+
As you can see, we've still got more work to do!
250279

251280
[benchmarks]: https://github.com/rust-lang-nursery/rustc-benchmarks
252281
[rss]: https://en.wikipedia.org/wiki/Resident_set_size
253282
[perf.rust-lang.org]: http://perf.rust-lang.org/
254283

255-
[`cargo check`] stabilized in Rust 1.16.0 and does a type check of a project
256-
without building it completely. This gives consistently fast feedback from the
257-
compiler. Take a look at [the 1.16 announcement] to see how `cargo check` can
258-
be incorporated into your workflow.
259-
260-
[`cargo check`]: https://github.com/rust-lang/cargo/pull/3296
261-
[the 1.16 announcement]: https://blog.rust-lang.org/2017/03/16/Rust-1.16.html
262-
263-
The work on incremental compilation is proceeding well. Nightly builds
264-
currently offer ["beta" support][incrcomp], permitting the compiler to
265-
skip over code generation. We are in the midst of refactoring the
266-
compiler to support finer-grained incremental computation, allowing us
267-
to skip type-checking and other parts of compilation as well. This
268-
refactoring should also offer better support for the IDE work (see
269-
next section), since it enables the compiler to do things like compile
270-
a single function in isolation. We expect to see the next stage of
271-
incremental compilation becoming available over the next few
272-
months. If you're interested in getting involved, please check out the
273-
[roadmap issue #4][roadmap-4], which is updated periodically to
274-
reflect the current status, as well as places where help is needed.
275-
276-
*Thanks to Niko Matsakis for this incremental compilation summary!*
277-
278-
[incrcomp]: https://internals.rust-lang.org/t/incremental-compilation-beta/4721
279-
[roadmap-4]: https://github.com/rust-lang/rust-roadmap/issues/4
280-
281284
### [Rust should provide a basic, but solid IDE experience](https://github.com/rust-lang/rust-roadmap/issues/2)
282285

283286
As part of our IDE initiative, we created the [Rust Language Server] project.

0 commit comments

Comments
 (0)