>big projects (my biggest project is 45k LoC) and it takes a couple of minutes to compile it
I don't think 45k LoC could be considered big, and I _do_ think a couple minutes compile time is a problem. I say that as a C++ programmer, a full recompile will easily get me out of the zone
It depends heavily on how you're counting lines of code and what C++ features you're using.
If you include a couple of C++ stdlib headers you're already well past 45kloc per compilation unit (for instance, including <vector> pulls in about 25kloc of code). Such a file usually compiles in a second or so, but the problem in C++ projects is that each source file pulls in the same headers over and over, which explodes the line count the compiler has to crunch through (I bet that in most bigger C++ projects, the actual project code is less than 5% of what the compiler actually needs to compile).
C is much more predictable, a 45kloc C project should compile and link in under a second for a full rebuild without optimizations, and at most 2..3 seconds with optimizations. The link-step is usually the critical part, since that's hard to speed up by throwing more hardware resources at it.
I have some projects of that size (ballpark), typically using some Boost (but not heavy on meta programming), Qt, and the likes. A fresh non-incremental compile usually takes less than a minute.
I have Rust projects that are many times smaller but take much more time for a non-incremental build. Of course, a large difference is that a fresh Rust build (after a cargo clean) compiles all its dependent crates, whereas many C/C++ libraries are provided pre-compiled by whatever system you are compiling on.
Well, what is the point in this comparison then? I'm not trying to say Rust is the fastest compiler on the planet, but really people don't even try to be objective.
If you're comparing, say, a 10 KLOC C++ program vs. a 10 KLOC Rust program, then the comparison is fair IMO. The end user doesn't care whether Rust chooses a different compilation strategy for dependencies.
End users run "cargo clean" really rare (I can't even name examples - really rare). If we compare regular compilation in C++, then we should take regular compilation in Rust, not something exceptional.
Like the others say: depends. But wasn’t saying C++ compiles faster, just that I know from experience that anything over a couple of seconds can ruin your flow.
No shit, I recently restarted a project [0] in straight C after giving it a serious try in C++. It's been a while since I dipped my toes, but a couple of weeks of decoding screens upon screens of template instantiations for every single compilation error and waiting minutes for a fresh build brings back memories. I'm not touching that madness with a ten foot pole again, they have some kind of crazy cult thing going where everyone agreed to pretend it's all good. Compiling the same thing in C is instant, I don't even want to think about how much time I wasted.
Well, if you can't even call a range (seconds, minutes, hours) then I can say that Rust is more predictable at least :)
Couple of seconds for 45k lines - I think you are too demanding :) But if C++ can compile it in couple of seconds - great, good competition for Rust :)
C++ compile times heavily depend on the code that is being compiled and the build system that is compiling it. Code that doesn't touch STL or boost or do much metaprogramming of its own is going to compile extremely fast (especially when compiled in parallel). Code that pulls in half of boost isn't going to compile so quick without tweaking the build settings. Due to how variable compilation times are, I don't think the range you provided is that unreasonable. Build time is something that changes on a project to project basis.
I don't think 45k LoC could be considered big, and I _do_ think a couple minutes compile time is a problem. I say that as a C++ programmer, a full recompile will easily get me out of the zone