Monday, November 26, 2012

Modules in C++

Modules in C++ is finally looking like it's going to happen. Doug Gregor has published an interesting set of slides, check it out [Modules Slides].

This will be huge! There was one factoid that summed up the whole problem with headers, and if you have ever wondered why C++ compilation is slow, then check out this source size comparison:

#include 

int main() {

  std::cout << “Hello, world!”

            << std::endl;

}

Once header substitution has occurred that nice 81 bytes of source blows into a whopping 1,161,033 bytes of convoluted template mess. What? The compiler has to parse a million characters just to print “Hello, world!” ??? That's crazy.

It's a wonder C++ compilers are as fast as they are. Really.

No comments:

Post a Comment