This is an archive of the discontinued LLVM Phabricator instance.

gn build: Use thin archives on Windows too when using lld
Needs ReviewPublic

Authored by thakis on Jun 22 2019, 8:20 AM.

Details

Reviewers
pcc
Summary

In a Release+Asserts build of clang/test llvm/test (the default gn build configuration) this reduces the size of out/gn/lib directory from 200MB to 40MB. The whole build directory is 2.4GB before this change, with 1.1GB in out/gn/bin binaries and 860MB in unittest binaries and 227MB in obj files. So this cuts the size needed to store just obj files in half as expected, but the obj size is just ~20% of total build directory size (or ~10% after this change).

When deleting out\gn\lib\clangCodeGen.lib and rebuilding clang, the old, thick archives need around 2.6s (0.2s to load the build graph, 0.1s to run lib, then 1.3s to run lld-link, and 0.8s to copy clang.exe to clang-cl.exe clang-cpp.exe clang++.exe). With thin archives, this rises to 3.5s (0.2s to load the build graph, 0.15s for lib, 1.9s to run lld-link, 0.9s for the copies). So this appears to be a bit slower, likely because lld-link has to collect .obj files from all over the disk for all .lib files, instead of having them all in one place.

Diff Detail

Event Timeline

thakis created this revision.Jun 22 2019, 8:20 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2019, 8:20 AM
thakis edited the summary of this revision. (Show Details)Jul 8 2019, 7:30 AM

I finished measuring the impact of this. It saves some disk, but not all that much, and it slows down links some (but not that much). If the numbers are similar on linux, maybe we shouldn't do thin archives in the llvm gn build? (Maybe the faster filesystem on linux makes hunting down all the .o files on linux less expensive, though.)