35 points · by rbanffy · 1y ago · 21 comments
> mold can link a 4 GiB LLVM/clang executable in ~1.8 seconds on my machine if the linker reuses an existing file and overwrites it. However, the speed decreases to ~2.8 seconds if the output file does not exist and mold needs to create a fresh file. I tried using fallocate(2) to preallocate disk blocks, but it didn't help. While 4 GiB is not small, should creating a file really take almost a second?
1s difference here is insane these days. There must be something weird going on, even if the physical disk is one of those ancient spinning things.
And even disregarding that, the linked LKML post mentions LLVM/clang at a case of building a 4GB executable. If you've ever built the LLVM project from source, there's about 50ish (?) binaries that need to be linked at the end of the build process -- it's not just clang, but all sorts of other tools, intermediate libraries and debugging utilities. So that is an example of a workload with "multi-GB executables being built at such a pace" -- saving 0.2 seconds per executable saves something like 10 seconds on the build.
To me that's an exotic workload which sounds interesting, hence why I'm curious.
The benchmarks on mold's README show that GNU gold takes 33 seconds to link clang, whereas mold takes 1.3 seconds. If you're a developer working on Clang, that's a pretty serious productivity improvement.
> 0.2 second wait between them is unacceptable.
It's more about sending a message, and I support the idea very much.It always starts with "it's only a fraction of a second" or "just 100kb more Javascript to load", and suddenly every website pulls in 25MB JS at least, and starting Windows calculator shows a splash screen (on a modern machine), because it takes that long to start up.
Down with shitty, bloated crapware. Mold FTW.
For example, running a compiler test suite I could understand, that would be quite impacted. But those tests wouldn't be multi-GB builds for the most part.
And I could understand being annoyed by it, but the author took steps to work around it, hence finding it unacceptable.
Far from my day job, so curious to know.
E.g. Chromium, Firefox, clang, including debug symbols will be quite sizable - Chromium sometimes trips me up when I somehow (usually accidentally) enable the debug config, and the only thing I see is the linker complaining that my 32-bit Arm target will be unhappy with the 6GB+ executable... I imagine some people do this intentionally, hacking on these projects directly.