On 13-08-23 11:41 AM, Bill Myers wrote:
>> > 2. Distribute compilations and tests across a cluster of machines (like
>> > distcc)
>> >
>>
>> Compilation is 99% serial (the only things that happen in parallel
>> are rustpkg and rustdoc etc at the end, and they are almost nothing),
>> though tests could be distributed (and Graydon is working on doing
>> that afaik).
> 
> Are you sure?

Pretty sure:

  - We essentially always do whole-program / link-time optimization
    in C++ terminology. That is, we run a whole crate through LLVM at
    once. Which _would_ be ok (I think!) if we weren't generating
    quite so much code. It is an AOT/runtime trade but one we
    consciously designed-in to the language.

  - We are self-hosted so always bootstrap. Stage N comes before stage
    N+1. Likewise when we cross compile, host comes before target.
    We have 3 stages and when doing an all-cross it grows to 9.
    You can't do those in any more parallel.

  - Parsing, type checking and similar middle-end passes could
    probably be parallelized eventually -- they were designed to
    support this in principle -- but in practice it would require
    a lot of rearchitecture. Also: these aren't the major speed
    points (possibly with the exception of typechecking, it's a
    _little_ bottleneck). Here's a normal compile phase-timing:

$ rustc -O -Z time-passes syntax.rs
time: 0.334 s   parsing
time: 0.002 s   std macros injection
time: 0.062 s   configuration 1
time: 0.355 s   expansion
time: 0.109 s   configuration 2
time: 0.107 s   maybe building test harness
time: 0.106 s   std injection
time: 0.113 s   ast indexing
time: 0.122 s   external crate/lib resolution
time: 0.011 s   language item collection
time: 0.779 s   resolution
time: 0.000 s   looking for entry point
time: 0.029 s   freevar finding
time: 0.064 s   region resolution
time: 0.017 s   region parameterization inference
time: 0.059 s   type collecting
time: 0.241 s   coherence checking
time: 5.623 s   type checking
time: 0.153 s   const marking
time: 0.013 s   const checking
time: 0.060 s   privacy checking
time: 0.021 s   effect checking
time: 0.010 s   loop checking
time: 0.021 s   stack checking
time: 0.170 s   compute moves
time: 0.073 s   match checking
time: 0.104 s   liveness checking
time: 0.478 s   borrow checking
time: 0.068 s   kind checking
time: 0.028 s   reachability checking
time: 0.103 s   lint checking
time: 3.974 s   translation
time: 33.939 s  LLVM passes
time: 0.080 s   linking

    As you can see, LLVM dominates. We generate a lot of code (I pointed
    to several clear culprits at the head of this email thread).

-Graydon

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to