1. 14

  2. 4

    I’m not a fan of equating Rust’s crates to C’s compilation units, because that sounds as if Rust had to naively rebuild whole crates every time, which isn’t true. The article only later goes into details of incremental compilation and breaking down into codegen units. Rust’s closest equivalent to C’s translation unit can be a single function, or 1/16th of a crate, or… well, it depends…

    1. 1

      Although it doesn’t correspond as a unit of incrementalism, doesn’t it correspond well as a unit of parallelism?

      1. 2

        That too is very “it depends”. Codegen units (LLVM code generation) within a crate build are coarsely parallel. Cargo builds crates in separate metadata and code-generation phases to squeeze more parallelism out of the dependency tree. rustc is being refactored from a batch compilation model to a parallel query model. Parsing and macro expansion are serial and done for the whole crate at once, but typechecking is getting more incremental and parallel.

    2. 2

      Actually all of the articles in this series are fantastic. I learned a lot, both technical and historical, and there’s links to all sorts of stuff.

      1. 1

        There is also a rather large social push to reduce the number of dependencies, which is less tangible but definitely contributes to the larger crates in the Rust ecosystem at large.