←back to thread

141 points vblanco | 4 comments | | HN request time: 0.859s | source
Show context
Asooka ◴[] No.44436332[source]
I would like to see a comparison between modules and precompiled headers. I have a suspicion that using precompiled headers could provide the same build time gains with much less work.
replies(4): >>44436478 #>>44436777 #>>44436830 #>>44439283 #
1. pjmlp ◴[] No.44436478[source]
As per Office team, modules are much faster, especially if you also make use of C++ standard library as module, available since C++23.

See VC++ devblogs and CppCon/C++Now talks from the team.

Pre-compiled headers have only worked well on Windows, and OS/2 back in the day.

For whatever reason UNIX compilers never had a great implementation of it.

With exception of clang header maps, which is anyway one of the first approaches to C++ modules.

replies(1): >>44438312 #
2. fpoling ◴[] No.44438312[source]
This has been puzzling me for over 3 decades. My first experience with C++ was Borland C++ for DOS. It had precompiled headers and it worked extremely well.

Then around 1995 I got access to HP-UX and native compiler there and GCC. Nobody heard about precompiled headers and people thought the only way to speed up compilation was to get access to computer with more CPUs and rely on make -j.

And then there was no interest to implement precompiled headers from free and proprietary vendors.

The only innovation was unity builds when one includes multiple C++ sources into super-source. But then Google killed support for it in Chromium claiming that with their build farm unity builds made things slower and supporting them in Chromium build system was unbearable burden for Google.

replies(1): >>44439308 #
3. barchar ◴[] No.44439308[source]
Fwiw doing a unity build with thin-lto can yield lovely results. That way you still get parallel _and_ incremental codegen.
replies(1): >>44442047 #
4. nh2 ◴[] No.44442047{3}[source]
Do you have some examples?

I cannot find any reports of the speedups people get with the combination of Jumbo/Unity builds and ThinLTO.