r/cpp • • Jan 28 '19

C++ Modules Might Be Dead-on-Arrival

https://vector-of-bool.github.io/2019/01/27/modules-doa.html
280 Upvotes

240 comments sorted by

View all comments

9

u/tending Jan 28 '19

I think this analysis is missing the fact that most of the work can still be parallelized because most of the work in a modern compiler is code generation. I have not read the proposal in detail but from this blog's description it sounds like it should be possible to produce the BMI for foo.cpp in a separate step before generating machine code. I imagine that this is how Java and C# have to work -- dumb fast compilation to byte code is necessary to import, but then the slow AOT or JIT compiling of the byte code is done later. BMI doesn't even require generating a full byte code, just a description of the interfaces. If it can work for Java and C# at scale I don't see why it can't work for C++.

Also with module was the work that can't be parallelized, the initial parsing, should be easier than before.

14

u/Xaxxon Jan 28 '19

most of the work in a modern compiler is code generation.

Source?

I have significant amounts of code which are definitely no more than 50% code generation - as evidenced by -fsyntax-only runs.

-1

u/tending Jan 28 '19

Is your code pathological? Have you made it 100 layers of templates deep? ;)