3 ms·
All I know is that C++ build times are painfully slow for large projects. Even if you spend a lot of time and effort on making them as fast as possible, they're
by slavik81 9y ago
All I know is that C++ build times are painfully slow for large projects. Even if you spend a lot of time and effort on making them as fast as possible, they're still not good.
#include just results in a tremendous amount of code in each and every source file. Even looking at a 6 line program, we see that after the preprocessor runs, the compiler is given 18,162 lines to process.
$ cat > main.cpp <<EOF
#include <iostream>
int main() {
std::cout << "Hello World!" << std::endl;
return 0;
}
EOF
$ gcc -E main.cpp | wc -l
18162
That is still nearly instantaneous, but it only gets worse from there and it happens to every source file in the project. I just took at look at a 1,848 line source file I'm working with, and it expands out to 147,054 lines after preprocessing. The current state of things is awful and modules are by far the most important feature for the future of C++. We need module support in our build tools and we need them to be fast.
Should the TS be delayed to see if the Clang idea is better? I'm curious to know what they're doing, but that's a lot to ask for. The TS is effectively a beta, and pushing back its start means less time in beta before the C++20 standard is finalized. There's a lot of work that's ultimately going to be built on top of this so getting it right is vital, but the clock is ticking.
- pjmlp 9y agoCppCon 2016 has some Google presentations about how they use clang modules (aka module maps). "Deploying C++ modules to 100s of millions of lines of code" https://www.youtube.com/watch?v=dHFNpBfemDI https://www.youtube.com/watch?v=dHFNpBfemDI "There and Back Again: An Incremental C++ Modules Design" https://www.youtube.com/watch?v=h1E-XyxqJRE&t=922s https://www.youtube.com/watch?v=h1E-XyxqJRE&t=922s