4 ms·
I work on C++ code at a large tech company. My workflow is such that I compile and run tests often after I made incremental changes. I feel like I often wait fo
by ma2rten 8y ago
I work on C++ code at a large tech company. My workflow is such that I compile and run tests often after I made incremental changes. I feel like I often wait for the linker for ages.
I am wondering if linking could be sped up. I feel like a lot of the steps mentioned here could be cached for instance.
- int0x80 8y agoIf it does LTO it gets worse. Maybe you can disable it for dev, if its enabled?
- mehrdadn 8y agoCan/do you have incremental linking enabled?
- pjmlp 8y agoDepends what you use as C++ compiler. Visual C++ supports incremental compilation and linking. https://blogs.msdn.microsoft.com/vcblog/2018/03/14/build-time-improvement-recommendation-turn-off-map-use-pdbs/ https://blogs.msdn.microsoft.com/vcblog/2018/03/14/build-tim... https://blogs.msdn.microsoft.com/vcblog/2014/11/12/speeding-up-the-incremental-developer-build-scenario/ https://blogs.msdn.microsoft.com/vcblog/2014/11/12/speeding-... https://blogs.msdn.microsoft.com/vcblog/2018/01/04/visual-studio-2017-throughput-improvements-and-advice/ https://blogs.msdn.microsoft.com/vcblog/2018/01/04/visual-st... https://blogs.msdn.microsoft.com/vcblog/2016/10/05/faster-c-build-cycle-in-vs-15-with-debugfastlink/ https://blogs.msdn.microsoft.com/vcblog/2016/10/05/faster-c-...
- johncolanduoni 8y agoI've seen (sometimes drastic) performance improvements when switching to LLVM's new linker lld[1]. It works quite well on both Linux and Windows in my experience. [1]: https://lld.llvm.org/ https://lld.llvm.org/
- jstimpfle 8y agoI, too, have been wondering that. On a high level, a linker does these things: - Read in objects file and parse linking information (needed symbols etc) - Do some in-memory calculations - resolving symbols and some other stuff. Simple graph theory. Is there any need for more than O(n log n) runtime?. - Write out object files I don't think anything should take so long. No caching needed. I read the series on linkers by gold's author, where significant speedups were claimed. And also, that object-oriented C++ was the right approach to software architecture. I strongly disagree with that second point and didn't understand too much from the article series to be honest. So I am not surprised at all that there are today even much faster linkers.