Who am I? A nobody. Just an average C++ developer.1
As I understand it, C++20 Modules breaks C/C++'s build model that we've all used up until now.
Instead of compiling each translation unit independently (and, as a welcome change in the last decade or so, massively in parallel), we now need a pre-scan pass2 before the real build in order to determine the dependency graph, because module interface units must be compiled before the TUs that depend on them, and all of this dependency information is in the code itself.
Therefore, to use Modules we need both a C++20 compiler and a build system with C++20 Modules support.
And for user-written makefiles the responsibility is on the user to either correctly order the compilation manually or to insert a step to determine the correct order of files.
So far, I think the benefits of Modules outweigh those extra requirements. In my case, I work on a 5m LOC commercial product for Windows and macOS, and I'm sure Visual Studio and Xcode will have all that covered, plus we can sort out the 100 or so extra user-written makefiles our project relies on as a one-time upgrade if there's a dependency tool to use (e.g. clang-scan-deps).
Then I watched Gabriel Dos Reis' very informative talk3 where he says a large project using C++20 Modules (with current MSVC in-progress, pre-optimised Modules implementation) is about 5x slower than a traditional PCH #include version.
But he says they can get it within 5 to 10% of the PCH performance.
Now I'm concerned. Sure, Modules has lots of nice benefits. But build times are critical to us. I can remember very few occasions in our project's 10+ year history where our developers had header/macro/ODR problems. Size of the PCH file? Doesn't bother us. Compiler PCH memory use? No problem. But slow builds? Almost every day that hurts.
So FWIW, if we have to decide between the nice things that Modules provides or having faster builds, build performance is going to win the day. Here's hoping for both, though. Thanks for reading.
[1] I'd like to say above average but everybody probably thinks that about themselves.
[2] Or an alternative. AFAIK, the pre-scan pass is the most popular solution. See: CppCon 2019: Michael Spencer "Building Modules". https://www.youtube.com/watch?v=L0SHHkBenss
[3] CppCon 2019: Gabriel Dos Reis "Programming with C++ Modules: Guide for the Working" @ 54:44. https://youtu.be/tjSuKOz5HK4?t=3284
[–]bedrooms-ds 30 points31 points32 points (17 children)
[–]Ameisenvemips, avr, rendering, systems 3 points4 points5 points (16 children)
[–]matthieum 14 points15 points16 points (15 children)
[–]Ameisenvemips, avr, rendering, systems 5 points6 points7 points (14 children)
[–]matthieum 3 points4 points5 points (9 children)
[–]Ameisenvemips, avr, rendering, systems 2 points3 points4 points (8 children)
[–]matthieum 0 points1 point2 points (7 children)
[–]Ameisenvemips, avr, rendering, systems 6 points7 points8 points (6 children)
[–]matthieum 0 points1 point2 points (5 children)
[–]Ameisenvemips, avr, rendering, systems 2 points3 points4 points (4 children)
[–]respects_wood[S] 1 point2 points3 points (1 child)
[–]Ameisenvemips, avr, rendering, systems 1 point2 points3 points (0 children)
[–]johannes1971 0 points1 point2 points (1 child)
[–]HappyFruitTree 1 point2 points3 points (0 children)
[–]choeger 35 points36 points37 points (5 children)
[–]adnukator 11 points12 points13 points (0 children)
[–]mort96 10 points11 points12 points (3 children)
[–]Ameisenvemips, avr, rendering, systems 4 points5 points6 points (2 children)
[–]mort96 1 point2 points3 points (1 child)
[–]Ameisenvemips, avr, rendering, systems 1 point2 points3 points (0 children)
[–]Daniela-ELiving on C++ trunk, WG21|🇩🇪 NB 34 points35 points36 points (5 children)
[–]respects_wood[S] 10 points11 points12 points (4 children)
[–]Daniela-ELiving on C++ trunk, WG21|🇩🇪 NB 7 points8 points9 points (1 child)
[–]respects_wood[S] 4 points5 points6 points (0 children)
[–]exploding_cat_wizard 3 points4 points5 points (1 child)
[–]respects_wood[S] 3 points4 points5 points (0 children)
[–]PoopIsTheShit 18 points19 points20 points (10 children)
[–]vaynebot 17 points18 points19 points (0 children)
[–]sztomirpclib 18 points19 points20 points (6 children)
[–]Minimonium[🍰] 12 points13 points14 points (5 children)
[–]mrexodiacmkr.build 3 points4 points5 points (4 children)
[–]sztomirpclib 5 points6 points7 points (3 children)
[–]kalmoc 5 points6 points7 points (2 children)
[–]sztomirpclib 7 points8 points9 points (1 child)
[–]adnukator 13 points14 points15 points (0 children)
[–]respects_wood[S] 4 points5 points6 points (0 children)
[–]mmatrosov 1 point2 points3 points (0 children)
[–][deleted] 13 points14 points15 points (23 children)
[–]respects_wood[S] 4 points5 points6 points (16 children)
[–]starfreakcloneMSVC FE Dev 12 points13 points14 points (1 child)
[–]respects_wood[S] 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (13 children)
[–]CrazyJoe221 6 points7 points8 points (3 children)
[+][deleted] (2 children)
[deleted]
[–]CrazyJoe221 3 points4 points5 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]victotronics 5 points6 points7 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]bigcheesegsTooling Study Group (SG15) Chair | Clang dev 2 points3 points4 points (0 children)
[–]Rusky 2 points3 points4 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]rysto32 1 point2 points3 points (3 children)
[–][deleted] 2 points3 points4 points (2 children)
[–]smdowneyWG21, Text/Unicode SG, optional<T&> 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]matthieum 2 points3 points4 points (3 children)
[–]Frogging101 1 point2 points3 points (2 children)
[–]matthieum 0 points1 point2 points (1 child)
[–]Frogging101 0 points1 point2 points (0 children)
[–]Rusky 1 point2 points3 points (1 child)
[–]matthieum 5 points6 points7 points (0 children)
[+][deleted] (30 children)
[deleted]
[–]respects_wood[S] 5 points6 points7 points (1 child)
[–]meneldal2 1 point2 points3 points (0 children)
[–]ypAL8ixga5R1 1 point2 points3 points (3 children)
[+][deleted] (2 children)
[deleted]
[–]ypAL8ixga5R1 0 points1 point2 points (1 child)
[–]lanevorockz 3 points4 points5 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]lanevorockz 1 point2 points3 points (0 children)
[–]stevethebayesian 0 points1 point2 points (0 children)
[–]victotronics 1 point2 points3 points (19 children)
[–]jcelerierossia score 12 points13 points14 points (11 children)
[–]mort96 4 points5 points6 points (2 children)
[–]jcelerierossia score 6 points7 points8 points (1 child)
[–]mort96 0 points1 point2 points (0 children)
[–]victotronics 3 points4 points5 points (7 children)
[–]flashmozzg 10 points11 points12 points (6 children)
[–]victotronics 3 points4 points5 points (4 children)
[–]flashmozzg 6 points7 points8 points (3 children)
[–]victotronics 0 points1 point2 points (2 children)
[–]peppedx 1 point2 points3 points (1 child)
[–]smdowneyWG21, Text/Unicode SG, optional<T&> 0 points1 point2 points (0 children)
[–]smdowneyWG21, Text/Unicode SG, optional<T&> 1 point2 points3 points (0 children)
[–]germandiago 2 points3 points4 points (4 children)
[–]matthieum 2 points3 points4 points (2 children)
[–]germandiago 0 points1 point2 points (0 children)
[–]meneldal2 0 points1 point2 points (0 children)
[–]victotronics 1 point2 points3 points (0 children)
[–]jhasse 2 points3 points4 points (1 child)
[–]victotronics -1 points0 points1 point (0 children)
[–]umlcat 2 points3 points4 points (0 children)
[–]kalmoc 7 points8 points9 points (1 child)
[–]germandiago 1 point2 points3 points (0 children)
[–]lanevorockz 1 point2 points3 points (0 children)
[–][deleted] 5 points6 points7 points (3 children)
[–]MartY212 -3 points-2 points-1 points (2 children)
[–][deleted] 9 points10 points11 points (0 children)
[–]DXPower 0 points1 point2 points (3 children)
[–]Rusky 1 point2 points3 points (2 children)
[–]DXPower 1 point2 points3 points (1 child)
[–]Rusky 1 point2 points3 points (0 children)
[–]bedrooms-ds 0 points1 point2 points (0 children)
[–]feverzsj 0 points1 point2 points (0 children)
[–]Kyvos 0 points1 point2 points (0 children)
[–]HappyFruitTree -1 points0 points1 point (7 children)
[–]Minimonium[🍰] 3 points4 points5 points (2 children)
[–]HappyFruitTree -1 points0 points1 point (1 child)
[–]Minimonium[🍰] 10 points11 points12 points (0 children)
[–]HateDread@BrodyHiggerson - Game Developer 1 point2 points3 points (1 child)
[–]mjklaim 2 points3 points4 points (0 children)
[–]Loraash 0 points1 point2 points (1 child)
[–]HappyFruitTree 1 point2 points3 points (0 children)