Get the latest tech news
C++20 Modules: Practical Insights, Status and TODOs
The post was written in Chinese and translated by LLM. Feel free to contact me if any phrasing seems unnatural.
Furthermore, if a project uses extensive template metaprogramming and stores constexpr variable values in Modules, the compilation speed can easily increase by thousands of times, though we generally do not discuss such cases. One impact of this behavior is that, compared to the previous model of one-to-one mapping with header files, the compiler loses the opportunity to inline the a() function in a.cc for optimization. The fact that Modules avoid repeatedly generating function bodies with non- inline linkage, as mentioned above, is one of the main reasons they save code size.
Or read this on Hacker News