<story><title>Hacking on Clang is surprisingly easy</title><url>https://mort.coffee/home/clang-compiler-hacking/</url></story><parent_chain><item><author>atq2119</author><text>The article mentions debug build time as a legitimate pain point about the LLVM project. General good advice, which unfortunately isn&amp;#x27;t enabled by default: use dynamic linking, make sure you&amp;#x27;re using lld, enable split dwarfs (and -Wl,--gdb-index for faster gdb load times!), enable optimized tablegen[0]. ccache doesn&amp;#x27;t hurt but isn&amp;#x27;t actually such a big benefit unless you switch between branches a lot.&lt;p&gt;Oh, and buy a Threadripper. Seriously, you won&amp;#x27;t regret it.&lt;p&gt;[0] TableGen is LLVM&amp;#x27;s internal DSL swiss army knife. You can separately enable optimizations for TableGen independently of optimizations in the resulting LLVM builds, which you should basically always do unless you&amp;#x27;re working on TableGen itself.</text></item></parent_chain><comment><author>ridiculous_fish</author><text>It&amp;#x27;s not the compilation that kills you, it&amp;#x27;s the sudden link at the end. Linking requires so much RAM it routinely succumbs to the OOM killer.&lt;p&gt;Do you have a trick to link serially? I usually just do a `ninja -j 1` after the main build has failed.</text></comment>
<story><title>Hacking on Clang is surprisingly easy</title><url>https://mort.coffee/home/clang-compiler-hacking/</url></story><parent_chain><item><author>atq2119</author><text>The article mentions debug build time as a legitimate pain point about the LLVM project. General good advice, which unfortunately isn&amp;#x27;t enabled by default: use dynamic linking, make sure you&amp;#x27;re using lld, enable split dwarfs (and -Wl,--gdb-index for faster gdb load times!), enable optimized tablegen[0]. ccache doesn&amp;#x27;t hurt but isn&amp;#x27;t actually such a big benefit unless you switch between branches a lot.&lt;p&gt;Oh, and buy a Threadripper. Seriously, you won&amp;#x27;t regret it.&lt;p&gt;[0] TableGen is LLVM&amp;#x27;s internal DSL swiss army knife. You can separately enable optimizations for TableGen independently of optimizations in the resulting LLVM builds, which you should basically always do unless you&amp;#x27;re working on TableGen itself.</text></item></parent_chain><comment><author>chrisseaton</author><text>Do you know why isn&amp;#x27;t it easier to offload compilation to the cloud yet? Compilation is an embarrassingly parallel problem and shouldn&amp;#x27;t need take longer than than slowest file plus linking. Compilation is also a pure function (I know it&amp;#x27;s not quite set up like that in practice but it is in theory) so it&amp;#x27;s stateless and cacheable. I would have thought developers could share a massive cluster and have thousand-way compilation instantly. Doesn&amp;#x27;t seem to be a thing people are building or using in practice for some reason.</text></comment>