Author: Jubilee
Created at: 2025-11-17 20:51
Number: 23
Clean content: Speaking in a broad way to answer a broad (“depends on many details”) question: In C, the primary compilation unit is each individual file. In Rust, the primary compilation unit is each entire crate. Rust offers many conveniences over C (e.g. not needing to “forward declare” things in various files) that depend on the fact it can treat crates as individual units. As a result, if you were to, for instance, compare the two languages based on “files compiled” but one is a crate, the results may be surprising. But with thoughtful (or just arbitrary) splitting of code, Rust does allow you to keep iterative builds relatively fast, especially if all the code you haven’t changed is in crates upstream of the one you changed. Paying attention to this is especially important for the -sys crates containing bindings, as bindgen essentially involves running a compiler to generate code and thus is not cheap. It’s worth noting that C also enjoys faster compilation with careful management of inclusions and include-guards on repeatedly-included headers. There are many caveats, exceptions, and and-alsos one can attach to what I just said when things get more specific. Some Rust idioms will not make it faster to build something, due to e.g. use of generics or #[inline] that requires multiple downstream instantiations in multiple downstream crates. And of course there’s ongoing work here, such as relink, don’t rebuild , where some of us are attempting to make it so changes to upstream crates only cause rebuilds of downstream crates if the upstream crate actually changed its public API.
