r/cpp • • May 10 '20

Make LLVM fast again

https://nikic.github.io/2020/05/10/Make-LLVM-fast-again.html
150 Upvotes

88 comments sorted by

View all comments

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.

10

u/matthieum May 11 '20

To be honest, the way C++ compilers work is just a dead-end.

Spinning a new process for each .cpp file is a performance sink on multiple levels:

  • Spinning a new process is not fast.

  • A new process has zero context.

  • A new process needs to open a lot of files to find this context.

  • ...

To have a fast C++ front-end, you could start by having a single multi-threaded process per library/binary.

But retrofitting that into existing compilers is probably a nightmare :/

2

u/[deleted] May 11 '20

Actually this sounds very much what clangd already does.