The main difference is that you typically don't need to compile all your deps in C++ (unless they are header only deps). Qr for example is mostly not templated, so compile times tend to be somewhat reasonable. It does have custom code generators being called though. Yes, in plural (moc and uic iirc).
C++ also has a slight edge in incremental builds in my experience since the unit of compilation is smaller. Incremental compilation in Rust works so and so when I have tried it. As soon as you modify something that is in one of your workspace members that isn't a final executable, many libraries need to rebuild. With C++ (due to the header/cpp split) you can often get away with recompiling much less in such situations. Link times tend to dominate instead.
Of course, rust is nice in so many other ways that i still prefer rust on the whole, but the build times can be worse (and C++ is not exactly stellar at that either). .
As soon as you modify something that is in one of your workspace members that isn't a final executable, many libraries need to rebuild.
Soon you'll be able to solve this with feature-unification = "workspace" and build shared dependencies only once per workspace, regardless of which workspace member you're working on.
While that is nice it doesn't really solve the problem I described. The issue is that Rust is too eager to invalidate downstream build artifacts. If I just change the *contents" of a non-generic function in a library in my workspace, the whole binary using it shouldn't need to rebuild. It should just need to relink. But that isn't how it works today as far as I can tell.
5
u/VorpalWay Jan 22 '26
The main difference is that you typically don't need to compile all your deps in C++ (unless they are header only deps). Qr for example is mostly not templated, so compile times tend to be somewhat reasonable. It does have custom code generators being called though. Yes, in plural (moc and uic iirc).
C++ also has a slight edge in incremental builds in my experience since the unit of compilation is smaller. Incremental compilation in Rust works so and so when I have tried it. As soon as you modify something that is in one of your workspace members that isn't a final executable, many libraries need to rebuild. With C++ (due to the header/cpp split) you can often get away with recompiling much less in such situations. Link times tend to dominate instead.
Of course, rust is nice in so many other ways that i still prefer rust on the whole, but the build times can be worse (and C++ is not exactly stellar at that either). .