"H.J. Lu" writes: > We can use mmap to map in ELF section contents, instead of copying them > into memory by hand. We don't need to cache symbol nor relocation tables > if they are mapped in. Data to link the 3.5GB clang executable in LLVM > 17 debug build on Linux/x86-64 with 32GB RAM is: > > stdio mmap improvement > user 86.73 87.02 -0.3% > system 9.55 9.21 3.6% > total 100.40 97.66 0.7% > maximum set(GB) 17.34 13.14 24% > page faults 4047667 3042877 25% > > and data to link the 275M cc1plus executable in GCC 14 stage 1 build is: > > user 5.41 5.44 -0.5% > system 0.80 0.76 5% > total 6.25 6.26 -0.2% > maximum set(MB) 1323 968 27% > page faults 323451 236371 27% > > Data shows that these won't improve the single copy linker performance. > But they improve the overall system performance when linker is used by > reducing linker memory usage and page faults. They allow more parallel > linker jobs on LLVM debug build. > > Here is a quote from Noah Goldstein: "on a large project they are an > extremely large speedup". Thanks for working on this. I've suffered from OOMs when linking large C++ projects with debug info a lot. I'm going to include it in my regular test builds.