| ▲ | kace91 16 hours ago |
| Doesn’t rust have incremental builds to speed up debug compilation? How slow are we talking here? |
|
| ▲ | steveklabnik 16 hours ago | parent | next [-] |
| Rust does have incremental rebuilds, yes. Folks have worked tirelessly to improve the speed of the Rust compiler, and it's gotten significantly faster over time. However, there are also language-level reasons why it can take longer to compile than other languages, though the initial guess of "because of the safety checks" is not one of them, those are quite fast. > How slow are we talking here? It really depends on a large number of factors. I think saying "roughly like C++" isn't totally unfair, though again, it really depends. |
| |
| ▲ | sfink 12 hours ago | parent [-] | | My initial guess would be "because of the zero-cost abstractions", since I read "zero-cost" as "zero runtime cost" which implies shifting cost from runtime to compile time—as would happen with eg generics or any sort of global properties. (Uh oh, there's an em-dash, I must be an AI. I don't think I am, but that's what an AI would think.) | | |
| ▲ | steveklabnik 12 hours ago | parent [-] | | I used em dashes before AI, and won't stop now :) That's sort of part of it, but it's also specific language design choices that if they were decided differently, might make things faster. |
|
|
|
| ▲ | esrauch 16 hours ago | parent | prev [-] |
| People do have cold Rust compiles that can push up into measured in hours. Large crates often take design choices that are more compile time friendly shape. Note that C++ also has almost as large problem with compile times with large build fanouts including on templates, and it's not always realistic for incremental builds to solve either especially time burnt on linking, e.g. I believe Chromium development often uses a mode with .dlls dynamic linking instead of what they release which is all static linked exactly to speed up incremental development. The "fast" case is C not C++. |
| |
| ▲ | embedding-shape 15 hours ago | parent | next [-] | | > I believe Chromium development often uses a mode with .dlls dynamic linking instead of what they release which is all static linked exactly to speed up incremental development. The "fast" case is C not C++. Bevy, a Rust ECS framework for building games (among other things), has a similar solution by offering a build/rust "feature" that enables dynamic linking (called "dynamic_linking"). https://bevy.org/learn/quick-start/getting-started/setup/#dy... | |
| ▲ | kibwen 5 hours ago | parent | prev [-] | | There's no Rust codebase that takes hours to compile cold unless 1) you're compiling a massive codebase in release mode with LTO enabled, in which case, you've asked for it, 2) you've ported Doom to the type system, or 3) you're compiling on a netbook. | | |
| ▲ | dwattttt 5 hours ago | parent [-] | | I'm curious if this is tracked or observed somewhere; crater runs are a huge source of information, metrics about the compilation time of crates would be quite interesting. | | |
|
|