←back to thread

302 points Bogdanp | 4 comments | | HN request time: 0s | source
Show context
taylorallred ◴[] No.44390996[source]
So there's this guy you may have heard of called Ryan Fleury who makes the RAD debugger for Epic. The whole thing is made with 278k lines of C and is built as a unity build (all the code is included into one file that is compiled as a single translation unit). On a decent windows machine it takes 1.5 seconds to do a clean compile. This seems like a clear case-study that compilation can be incredibly fast and makes me wonder why other languages like Rust and Swift can't just do something similar to achieve similar speeds.
replies(18): >>44391046 #>>44391066 #>>44391100 #>>44391170 #>>44391214 #>>44391359 #>>44391671 #>>44391740 #>>44393057 #>>44393294 #>>44393629 #>>44394710 #>>44395044 #>>44395135 #>>44395226 #>>44395485 #>>44396044 #>>44401496 #
ceronman ◴[] No.44391359[source]
I bet that if you take those 278k lines of code and rewrite them in simple Rust, without using generics, or macros, and using a single crate, without dependencies, you could achieve very similar compile times. The Rust compiler can be very fast if the code is simple. It's when you have dependencies and heavy abstractions (macros, generics, traits, deep dependency trees) that things become slow.
replies(2): >>44391384 #>>44392083 #
1. 90s_dev ◴[] No.44391384[source]
I can't help but think the borrow checker alone would slow this down by at least 1 or 2 orders of magnitude.
replies(3): >>44391473 #>>44391548 #>>44391760 #
2. steveklabnik ◴[] No.44391473[source]
Your intuition would be wrong: the borrow checker does not take much time at all.
3. FridgeSeal ◴[] No.44391548[source]
Again, as this been often repeated, and backed up with data, the borrow-checker is a tiny fraction of a Rust apps build time, the biggest chunk of time is spent in LLVM.
4. tomjakubowski ◴[] No.44391760[source]
The borrow checker is really not that expensive. On a random example, a release build of the regex crate, I see <1% of time spent in borrowck. >80% is spent in codegen and LLVM.