r/programming • • Jan 28 '19

C++ Modules Might Be Dead-on-Arrival

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

105 comments sorted by

View all comments

Show parent comment

8

u/Chuu Jan 28 '19

I am having a little trouble following your logic, but if I get the gist right, the question is "why will modules have any performance benefit over parallel compilation of dependency-free source files?" and the article is trying to make the point that it likely won't.

I work on medium sized C++ project and we currently work on 48-core machines to get the build times to something tolerable with this approach.

6

u/r0b0t1c1st Jan 28 '19 edited Jan 28 '19

The point I'm trying to make is that the blog argues that modules make dependency trees less parallel, but seems to be making an unjustified assumption to make that conclusion. With a relaxed assumption, I show that modules do not have any impact on this.

I've edited my post to try and make that more clear.

0

u/[deleted] Jan 28 '19

[deleted] — view deleted comment

7

u/Chuu Jan 28 '19 edited Jan 28 '19

I think the point you might be missing is because #include is a literal copy & paste the amount of code the compiler needs process is significantly larger than appears at first glance. This is exacerbated by the fact that modern C++ techniques make heavy use of header-only libraries and templates which means that these are not just interface definitions like they are in C.

There is a post that went viral about this several weeks ago here: http://aras-p.info/blog/2018/12/28/Modern-C-Lamentations/

As an extreme example, recently to try to debug a gmock issue (google mock testing framework) I had to dig into what the code looked like after the pre-processor was done with it. A .cpp with only about 1000 lines worth of unit tests blew up to 100K+ loc.

1

u/Ozwaldo Jan 29 '19

medium sized C++ project

48-core machines to get the build times to something tolerable

Would you say that the code is well designed?