3 ms·
> Because Rust's unit of compilation (a crate) is very large. In C/C++ it's a single file. What do you mean exactly here?
by ladyanita22 3y ago
> Because Rust's unit of compilation (a crate) is very large. In C/C++ it's a single file.
What do you mean exactly here?
- IshKebab 3y agoIn C++ you can compile each file independently from every other file. You can't do that in Rust; you can only compile crates (which are made of many files) independently. Within a crate you can have circular references for example. So the smallest chunk of work that can be parallelised is much bigger in Rust than in C++. (Unless you are writing atypically small Rust crates and atypically enormous C++ files.)
- ladyanita22 3y agoI understand that's not a language limitation, but rather a compiler/toolset/ecosystem issue (like not having a standard ABI?). I ask becasue I wonder what's the real culprit here and whether it can be solved or if it's due to the language.
- miniupuchaty 3y agoIt is like you say, mostly compiler/toolset/ecosystem, all 3. While staying in the same ecosystem you can split your application into smaller crates, which many are doing. It's just not that ergonomic.
- IshKebab 3y agoIt kind of is a language limitations. They could have said "no circular dependencies at all!" (which is quite reasonable) and then it would be easier to deal with.