r/cpp • u/vormestrand • May 10 '20
Make LLVM fast again
https://nikic.github.io/2020/05/10/Make-LLVM-fast-again.html78
May 10 '20 edited May 10 '20
Very nice work by the author but I am bit concerned about the attitude that "optimization is already good enough, and additional optimizations have the unfortunate trend to trade large compile-time increases for very minor improvements".
I would let my compiler run for a day for minor improvement in the release build to try all kind of inlining decision for example. I really hope that any compiler speed optimizations that results in runtime regressions will be reserved to -O0 and -O1. Or maybe we need an -O4 for the kind of extremely slow optimizations.
Generally my experience has been that release builds don't feel significantly slower. I did this completely none scientific test with the code I happen to have to have open right now and the debug builds takes about 4.5 seconds in -O0 Clang and the -O3 link time optimization release build takes about 5.5. With the MSVC the difference is even smaller. btw I am not doing anything crazy with templates, I am generally very concerned about header includes and I am linking dynamically for development builds.
I don't really know what the compiler is doing but 4.5 seconds is WAY too long for these couple source files, it's less than 10 000 source lines being recompiled.
My impression is that optimizations are already "too fast", it's just that general compilation somehow is really slow. What if maybe ironically Clang's own release could get 5% faster with an "aggressive optimization" switch that just tries a bunch of stuff over 24h?
35
u/Veedrac May 10 '20
I would let my compiler run for a day for minor improvement in the release build to try all kind of inlining decision for example.
I suspect the majority of people don't even run LTO or PGO.
10
u/gcross May 10 '20
In C++ you probably don't even get as much benefit from LTO as you might get with other languages since so much code already lives in headers--in part because this is required when writing generic code using templates, and in part because people often find it easier to distribute their libraries as a collection of headers rather than dealing with the vagaries of building on multiple platforms--that the compiler already sees a significant fraction of the code when compiling each module and thus seeing the rest of the program at link time doesn't open up too many more opportunities for optimization that it had not seen already.
Personally I have often had trouble getting LTO to work reliably so a lot of the time I find myself putting method definitions directly in the header since otherwise they won't get inlined--and this isn't just a gut feeling, because I can see the difference in performance before and after using a profiler, so I know that the problem is with the LTO either not turning on for some reason or not being very smart.
15
u/Netzapper May 11 '20
I use LTO on embedded projects. It can make a big difference in binary image size.
4
u/IAlsoLikePlutonium May 10 '20
Maybe it is just me, but LLVM’s LTO doesn’t seem to work on Windows. It always complains of a linker error and fails to link :-(.
Does it normally work on Linux or Mac OS?
8
5
u/kirbyfan64sos May 10 '20
I've never had any issues using it on Linux, and although that's rather anecdotal, I know a lot of people / distros / environments that use LTO frequently.
1
u/Xeverous https://xeverous.github.io May 12 '20
Got similar issue, but with MinGW. LTO is very slow (multiple times longer linking) and I have a library that frequently ends with abnormal linker errors (eg multiple destructor or vtable definitions).
1
u/bumblebritches57 Ocassionally Clang May 10 '20
I use LTO on my libraries, but they're not mature enough yet for PGO.
0
May 10 '20
[deleted]
3
u/pandorafalters May 14 '20
Another issue with PGO that I encountered is the (I suppose unusual) case where the cold path is the critical path. One path may churn away for days on end, but when the other is entered it needs to finish RFN.
12
u/tambry May 10 '20
My impression is that optimizations are already "too fast", it's just that general compilation somehow is really slow. What if maybe ironically Clang's own release could get 5% faster with an "aggressive optimization" switch that just tries a bunch of stuff over 24h?
Building LLVM/Clang with ThinLTO and performing Frontend PGO with a specific codebase results in 20–30% faster compile times. Caveat is that it's annoying to setup. I automated that at work along with packaging our toolchain+sysroot.
9
u/kalmoc May 10 '20
I would let my compiler run for a day for minor improvement in the release build to try all kind of inlining decision for example.
My gut feeling is that currently the best investment of that time is collecting profiles and then compiling with PGO. Without some information about typical workloads, there are a lot of tradeoffs, where the compiler just can't make an informed choice.
5
u/AlexReinkingYale May 11 '20
I am bit concerned about the attitude that "optimization is already good enough, and additional optimizations have the unfortunate trend to trade large compile-time increases for very minor improvements".
As a compiler writer myself, I agree with the author for the most part. If you need absolute maximum performance, you either shouldn't expect your compiler to give it to you or you shouldn't be writing in C/C++.
Here's what good enough means: the compiler's output won't bottleneck your optimization efforts. And this is mostly true. No matter what sort of application you're writing, the quality of LLVM's output is so high that the most important optimizations come from large-scale reorganizations of computation and resource loading, full stop.
I would let my compiler run for a day for minor improvement in the release build to try all kind of inlining decision for example. I really hope that any compiler speed optimizations that results in runtime regressions will be reserved to -O0 and -O1. Or maybe we need an -O4 for the kind of extremely slow optimizations.
So I don't think this would help very much. Inlining isn't the only transformation that might make a program go faster, and it certainly isn't enough to improve your program's cache locality, data access and layout patterns, etc. For inlining specifically, LLVM is doing some really cool work replacing hand-rolled heuristics with ML-based ones. Other transformations (especially data layout) aren't up to the compiler thanks to ABI constraints.
The alternatives are to either painstakingly write assembly, or encode the particulars of the problem you're trying to solve in a domain-specific language. In a well-designed DSL, the space of allowable optimizations is much more targeted and you can push your performance much farther than you can in C/C++ alone.
1
u/MrWhite26 May 17 '20
or encode the particulars of the problem you're trying to solve in a domain-specific language.
The combination of SIMD intrinsics and template functions allows defining something like a DSL within C++.
It keeps all the compiler optimizations, but allows explicit instructions for a specific set of particulars.
1
u/AlexReinkingYale May 17 '20
Eh, not really. The closest thing to a success story I can think of along these lines is Eigen and it struggles to get good performance once your processing pipeline gets more than a level or two deep. The issue is that it isn't able to find good fusions or tilings of operations, automatically parallelize, or introduce redundant work that would enable parallelism. A proper DSL can make these global reorganizations much more easily.
4
u/RasterTragedy May 11 '20
Perhaps an -O4 really is warranted. Maybe moving some less-impactful stuff out of -O2 and into -O3?
The other perf target to track would actually be RPCS3, which uses LLVM to recompile Cell executables into x64, which is yet another unique usage pattern that I don't think is covered by Rust or C(++|) compilation. RPCS3 is a bit of a moving target tho, so using it as a benchmark is kind of a weird proposition logistically, although I'm not sure if its LLVM usage experiences that kind of variance to begin with. RPCS3 has actually found at least one LLVM bug, so there is that.
8
u/CrazyJoe221 May 10 '20
That's because your 10000 lines easily become a million after preprocessing.
68
u/dakotahawkins May 10 '20
Would people really sacrifice run-time performance for a little compile-time performance?
104
u/lukaasm Game/Engine/Tools Developer May 10 '20
For debug/development builds? Yes. For final/distributed build done by CI? No.
23
May 10 '20
LLVM is used in many projects. If your language is JIT compiled and you use LLVM, then yes.
24
u/Veedrac May 10 '20
A faster compiler has more time to produce faster code.
a little compile-time
LLVM is easily two orders of magnitude slower than it needs to be.
5
u/uninformed_ May 10 '20
I wouldn't get hung up on the runtime / compiletime statement. None of the changes discussed in the article would affect the generated code, as far as I can tell.
7
u/eras May 10 '20
You should try OCaml and see what a fast compilation feels like ;). Though in case of LLVM you would like a lot more compile-time performance.
In other words, yes; and what /u/lukaasm said.
10
May 10 '20
As much as OCaml is awesome, it has an easier job of compiling fast because of its uniform value representation (i.e. no monomorphization). A single function doesn't have to be compiled multiple times for each specialization (maybe they do specialize some calls for optimization but definitely not everything, like cpp does).
4
u/eras May 10 '20
Yes I thought that's what this discussion is about: you can build less optimal code faster and faster compilation may result in better experience to developers!
Is there something in the semantics of ie. Rust stopping it from doing the same? Probably too big of an effort to do it, but even if it was done, I doubt it would completely—or even nearly?—solve its compilation speed woes. I recall there are some nice presentations of this subject.
29
u/vineek May 10 '20
Everyone seems to agree that runtime performance is significantly more important than compile-time performance. However, not many seem to consider the fact that compile-time performance is the actual RUNTIME performance of the compiler. In the end, if we want faster software in general, we cannot exclude compilers from this rule.
Especially considering the ever more important developer time. I completely agree that compile-time regression checks would be a great tool
32
u/zkwarl May 10 '20
I really wish compiler developers paid more attention to compile-time performance. We all want super-well optimized binaries, but this is at the cost of waiting longer for the build to finish.
Developers’s time is expensive! The faster the tools can turn around results, the faster devs can get stuff done. For a large team, the aggregate wait cost can get quite steep, both in real time costs and in the frustration levels.
19
u/elperroborrachotoo May 10 '20
There's little reason to assume it's just neglect or laziness. Compiler makers suffer the same as other developers.
Their top priorities are correctness, size and speed of the generated code. More focus on codegen speed means: less correct compilers, worse codegen, or slower progress in features.
Or, if we somehow find a way to throw more developers on compilers: less ressources on other projects.
9
u/ShillingAintEZ May 10 '20
The fallacy here is that it's all linear. There could be lots of low hanging fruit performance wise that would make a big difference in speed but not be a major time sink rabbit hole. As mentioned earlier, not instantiating the same templates over and over could be one of those things.
3
u/mat69 May 11 '20
Well the clang team also needs to compile their changes. Thus they directly benefit of better compile times themselves.
3
u/elperroborrachotoo May 11 '20 edited May 11 '20
yeah, which is why there probably aren't too many "low hanging fruit", as another commenter hopes for.
2
5
u/PlanarLightfoot May 10 '20
I think C++ modules will eliminate this concern over time.
7
u/dagmx May 11 '20
It would help mitigate the slowdown but you’d still see the slowdown for each module. Additionally llvm is used for a lot more than C++ and those languages will feel this regardless of how C++ evolutions might help them.
11
u/---sms--- May 10 '20
amazingly fast compiles
Totally not my experience with Clang.
Clang is almost 2 times slower than MSVC when I write no C++ code at all:
(Measure-Command { & clang++.exe -c -x c++ "C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\Windows.h" -Wno-pragma-once-outside-header }).TotalSeconds / (Measure-Command { & cl.exe /nologo /c /Tp"C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\Windows.h" }).TotalSeconds
1,89302995640114When I do, it can easily be 20x slower.
11
May 10 '20
Clang on windows is not well optimized tbh. There are a lot of tricks to make it go faster - but I wish it could be faster out of the box in the future.
10
u/PoliteCanadian May 10 '20
How is running on Windows killing its performance? It is a load of compute sandwiched between some basic file IO. And it is a compiler so I would assume it is self hosting and generating basically the same code...
27
May 10 '20
There was a discussion on llvm-dev about this recently. Apparently the number/size of allocations that LLVM is doing is really not performing well with windows stock allocator. The author there switched to RPMalloc and saw a 10% performance gain. My guess is that visual studio is better at behaving there.
A generic problem with llvm.org binaries for all platforms are that they are not built with LTO and PGO to speed them up. Just downloading the source and building with those options will see a great speed increase as well.
0
May 10 '20
[deleted]
8
May 10 '20
Probably because no one has done the work and submitted patches. Release builds are done by release testers so it’s a very manual process. Getting a full LTO+PGO build done requires some effort and a lot of cpu power.
16
u/Fazer2 May 10 '20
For exaample, Linux doesn't have Windows Defender scanning I/O and processes in real time.
7
u/Myriachan May 10 '20
Compiling often involves opening and reading like 100 header files.
9
u/SkoomaDentist Antimodern C++, Embedded, Audio May 10 '20 edited May 10 '20
And a lot of software originally written on Unix makes some utterly braindead choices since those just didn’t happen to be too costly on those platforms. Just count how many total fork and exec calls across all the sub executions a typical make run performs compared to the actual number of times it needs to run the compiler.
1
u/bumblebritches57 Ocassionally Clang May 11 '20
tbf, make is basically dead these days with Cmake and Ninja be pretty common.
12
u/gcross May 11 '20
That is an odd thing to say given that CMake generates Makefiles by default on unixy platforms.
3
u/SkoomaDentist Antimodern C++, Embedded, Audio May 11 '20
Is it? I've yet to run into programs provided in source form that did not use make either directly or indirectly when I have to compile them myself. Quite often they even use the abomination known as Autoconf.
1
u/bumblebritches57 Ocassionally Clang May 12 '20
Oh god automake/conf and theres more but i forget them.
They’re all garbage.
1
u/bumblebritches57 Ocassionally Clang May 11 '20
There's a lot of workarounds LLVM has to do to support windows.
the biggest one is they don't use shared libraries on windows, and i'm not entirely sure why either, everything has to be compiled as static libraries and linked into massive binaries tho.
1
u/kalmoc May 11 '20
Don't know why llvm can't use dlls on windows, but shouldn't building everything into a single exec - if anything - improve performance of the binary?
1
u/bumblebritches57 Ocassionally Clang May 12 '20
I run into all kinds of strange issues when i use Clang when rarely use windows.
It doesn’t support OpenMP, and i half remember it having a problem with link time code generation too.
It’s just wonky.
7
u/janisozaur May 10 '20 edited May 10 '20
Shouldn't you be using clang-cl for that?
I usually have negative experiences with Windows, everything is just somehow slower, don't really know why and don't quite care, but I have yet to see a real world scenario where MSVC compiles anything faster than GCC/clang, especially when a quarter of time is easily spent in msbuild. Usually replacing it with ninja had the biggest impact of improving compile times. Your example is surprising and makes me think perhaps this is isolated to the windows-specific part? I rarely see llvm in action on Windows, so it would be interesting to compare those times with runs on Linux.
Oh, and please provide versions of software, I recall some perf improvements to clang on Windows, will edit the post when I find a link
Edit: https://reviews.llvm.org/D69825 and https://reviews.llvm.org/D52411
5
u/---sms--- May 10 '20
clang-cl
Yes, I could use it, but it won't change my measurement. I have no problems using clang++.exe for everything, btw, which is nice.
real world scenario where MSVC compiles anything faster
Compiling clang stage0 (with MSVC, ninja) takes around 1 hour on my machine, but stage1 (when resulting clang compiles itself, ninja too) takes around 2 hours.
this is isolated to the windows-specific part?
Most likely it is in windows-specific part. https://bugs.llvm.org//show_bug.cgi?id=34356
provide versions of software
today's trunk
2
u/kalmoc May 10 '20
Are the two stages actually doing the same work? E.g. are the same utilites and plugins compiled and is compilation happening with comparable build flags?
2
u/---sms--- May 10 '20
I'm using build_llvm_package.bat (except I'm not building 32-bit versions) and the only difference I'm aware of is:
set CC=..\build64_stage0\bin\clang-cl set CXX=..\build64_stage0\bin\clang-cl
2
u/CenterOfMultiverse May 11 '20
http://llvm-compile-time-tracker.com/graphs.php?stat=wall-time - why wall time for fat LTO is lower than thin LTO (or sometimes even no LTO at all) in some cases?
4
u/czipperz May 10 '20
Jonathan Blow has created a programming language called Jai and has said that it is faster to emit C code and run it through MSVC than to emit LLVM IR and run it through LLVM for debug builds. And he spent a lot of time optimizing and tweaking it.
9
u/griceylipper May 10 '20
AFAIK the C backend for Jai is a thing of the past - the two backends you hear about now are the LLVM one, and his own x64 instruction generation. With his x64 one, I think he is aiming to compile 1 million lines of code per second eventually. It's nuts that a relatively small team can pull this off, but that the huge scale of effort that goes into the likes of Clang and other similar compilers can come nowhere near this level of performance.
4
u/czipperz May 10 '20
You are correct it's a thing of the past. However it doesn't erase the fact that llvm (on windows) is incredibly slow.
1
3
u/kalmoc May 11 '20
Well, it is a different language no?
-2
u/griceylipper May 11 '20
Yes, but my point is this - when you consider the decisions made by the people designing C++, and the effort going compilers like Clang - both must be severely misguided before a very small team like Thekla can produce a very serious competition that is many orders of magnitude faster. Yes, C++ is more complicated, but only because it was designed that way. Jonathan Blow cares about the time developers waste waiting on compilation, trying to understand bad error messages, etc., and keeps the "joy of programming" as a very high priority. I honestly think C++ will start to fade away to be another language of the past like Fortran or COBOL once Jai is (eventually) released.
6
u/kalmoc May 11 '20 edited May 12 '20
Yes, C++ is more complicated, but only because it was designed that way.
It wasn't designed that way. It (and it's tooling) evolved over decades (K&R-C is from the late seventies) with strong backwards compatibility constraints on computer systems whose performance characteristics don't really resemble what you have on modern machines and to make things even more difficult, that evolution has been largely based on compromises between the needs of very different platforms and industries.
I find it pretty unsuprising, that a new, clean slate language with a pretty narrow focus for what it is designed (games?) an with a small design team (
one guy4 people?) can be tremendously more efficient to compile than c++. Actually, we have had such languages for quite some time alread (C# and Java).I honestly think C++ will start to fade away to be another language of the past like Fortran or COBOL once Jai is (eventually) released.
Very much possible.
EDIT: At the end of the presentation: "It makes program a lot simpler and a lot faster if you can agree on some basic ways of doing things". That's c++ main problem in one sentence.
1
u/pjmlp May 12 '20
Being from late seventies isn't really an argument, given the programming languages tooling that was available outside Bell Labs.
Not wanting to depend on anything beyond primitive UNIX linker model was what lead to this situation.
1
u/kalmoc May 12 '20
True. My main point was not that it is based on old technology, but that c++ is the result of an evolutionary process with lots and lots of compromises going on for about 40 years.
1
u/pjmlp May 12 '20 edited May 12 '20
Indeed, however by C++98 we could have already had a better linker model, with modules and such, instead of keeping using what was the Trojan to get C with Classes adopted by C devs.
Since I come from the PC/Amiga world, I think had FOSS UNIX clones not taken off in the late 90's, and the whole C compatibility story wouldn't be as relevant as it still is today, given that all desktop OSes and early PDAs like Newton/Psion were going into C++.
3
u/encyclopedist May 11 '20
Last time I tested, clang and GCC were able to compile about 200k lines per second (after preprocessing). There are no "many orders of magnitude".
Also, we are discussing LLVM here, which does not know much about the language we are compiling.
Also, as far as I know, Jai's backend has very rudimentary optimizations.
2
u/griceylipper May 11 '20
clang and GCC were able to compile about 200k lines per second (after preprocessing)
I'm skeptical regarding that figure - do you have any links you can point me to? I know this is really old, but here Jonathan Blow discusses progress of speed in his language at a time when it was not at its best. He specifically talks about 1m loc/sec at 25:21.
Also, as far as I know, Jai's backend has very rudimentary optimizations.
Jai has two backends - an LLVM one to take advantage of optimisations for release builds, and his own x64 backend for development. The x64 backend is more rudimentary, but that's sort of the point - it's designed for fast turnaround. Some limited optimisation has been spoken about for this, but it will never be as optimised as the LLVM backend, because that's not its purpose.
4
u/matthieum May 11 '20
Be careful of any template instantiation in that comparison.
A few lines of source code can easily result in a lot of invisible "generated" code.
I sometimes wish it was possible to emit post-monomorphization code, to see which templates are the biggest offenders in term of compile-time.
2
u/encyclopedist May 11 '20
I don't remember what code I tested that time, so I started now with a hello world code.
#include <iostream> int main() { std::cout << "Hello" << std::endl; }Then I preprocessed it
g++ -E -std=c++17 hello_world.cpp > preprocessed.cppPreprocessed file is 773 kB in size, with 22k lines of code:
$ tokei preprocessed.cpp ------------------------------------------------------------------------------ Language Files Lines Code Comments Blanks ------------------------------------------------------------------------------- C++ 1 31761 22020 0 9741 ------------------------------------------------------------------------------- Total 1 31761 22020 0 9741 -------------------------------------------------------------------------------Compilation of this file takes 0.3 s
Benchmark #1: g++ -c -std=c++17 -O3 preprocessed.cpp Time (mean ± σ): 305.1 ms ± 7.3 ms [User: 281.8 ms, System: 23.4 ms] Range (min … max): 295.8 ms … 315.6 ms 10 runsWhich means GCC can compile 73 kloc/s. Lower than 200 kloc/s I mentioned before, but still not "many orders slower". Clang compiles the same code in ~270 ms.
I also tested on more realistic code. I took the file ninja.cc from Ninja build system. Preprocessed file is 1.7 MB in size and has 45.7 kloc. It takes 830 ms to compile, which gives ~ 55 kloc/s.
3
u/jpakkane Meson dev May 11 '20
both must be severely misguided before a very small team like Thekla can produce a very serious competition that is many orders of magnitude faster
Well let's test this. I don't know what CPU and code they used, but for comparison I took SQLite's one amalgamation file 3080802 and ran some tests on a five+ years old MBpro with an i5 processor.
Lines of code as reported by wc: 153367 Lines of code after clang -E: 83913 Time of clang -c -o /dev/null 1.5 s Time of clang -g -O2 -c -o /dev/null 29 sSo depending on how you count, debug builds are between 102k to 56k lines per second, whereas optimized builds can do 5300-2900 lines of code per second. Parsing and basic code generation is not the slow bit, optimizations are. If Jai can do 1 MLoC/second (and that is a big if), C compilers of today are only one order of magnitude slower.
The fact is that there are a lot of things we don't know about Jai and until it has been used by a large set of independent people we don't really know whether it is any good. This includes things like:
How fast is the final generated code compared to an existing C++ compiler? About the same? Slower? Faster? We don't know. Simply being something like 5% slower would be a blocker for many people.
Blow is very opinionated on what a programming language should do (i.e. all the things he personally likes) and what it should not do (everything else) and has no qualms about telling people that their opinions are wrong and stupid. What if your requirements differ and you really need something that he will refuse to add in?
At some point Jai did not support incremental builds, all targets were built from scratch to the final exe regardless of how small a change you did. If this is still the case, it will hurt huge projects (like Unreal Engine) pretty badly.
If you compile everything in one go, does that mean it runs only one thread for it or can it parallelise the compilation somehow? If not then optimized dev builds are going to be very slow.
How easy will it be to add Jai to an existing MLoC C++ code base? For example Rust is hard to integrate into existing projects because of Cargo and its insistance to do everything its own way. Rewriting multi-MLoC code bases is a no-go.
How buggy is the compiler? Typically these things go so that the small team developing the project learn to write code that avoids all the buggy bits. Outsiders will not do that, they expect things to work.
Does it produce full debug info? Is there integration to things like gdb? Does it actually work?
3
u/ner0_m May 11 '20
I would love such an approach for C++
I (who only codes x86) would love a compiler, with really fast compilation for x86, and decent or acceptable (debug) run time. Then I can compile and check my code quickly and still use LLVM and GCC for my release build.
I really like the idea of having specialized tools for specific tasks, if a general approach is just to complex. Maybe something like that can be achieved with new C++ compiler only supporting modules or something...
0
u/griceylipper May 11 '20
Jai isn't out yet, but I'd highly recommend taking a look at it when it does. I honestly don't think I'll ever go back to C++ when this is an option.
2
u/pine_ary May 10 '20
That might work on Windows. But keep in mid that LLVM isn't as optimized for Windows as it is for other OSs. Jai is also a specialized language seems to be simple to convert to C. Converting C++ isn't as easy and my suspicion is that C++ -> C -> MSVC would not come out on top of Clang -> LLVM. Additionally you need to consider the optimizations you can apply when converting to IR. Converting to C by itself is not really useful if you don't use the language specific knowledge (for example knowledge of the standard library) to optimize in that step.
2
u/kalmoc May 11 '20
Converting to C by itself is not really useful if you don't use the language specific knowledge (for example knowledge of the standard library) to optimize in that step.
Are c++ compilers doing that? I had the impression that they treat STL code just like any other code.
1
u/Xeverous https://xeverous.github.io May 12 '20
Since a long time all major C++ compilers are compiling C++ directly. Only the fisrt compilers were translating C++ to C (for faster implementaton with then existing C compilers), today it would be a waste of a lot of information.
1
u/kalmoc May 12 '20
And I didn't say any such thing. I was talking about using knowledge about the STL in the compilation process, responding to
(for example knowledge of the standard library)
0
May 10 '20
[deleted]
54
u/lord_braleigh May 10 '20
LLVM doesn’t compile C++, it compiles LLVM IR. Clang compiles C++ into LLVM IR first.
17
u/DXPower May 10 '20
With things like concepts, the compiler can apply simpler and more easily found heuristics on template types instead of dozens to possibly hundreds of SFINAE expansions.
With modules, dependencies on a header don't have to be recompiled as often and headers don't have to be reparsed nearly as often
-3
39
u/johannes1971 May 10 '20
I imagine it would already help a lot if it stopped instantiating the same templates again and again and again. The mind boggles that the work by the zapcc compiler was never picked up by any mainstream compiler, despite it being considerably faster than any other C++ compiler.
Source.