diff options
| author | Joshua Nelson <jnelson@cloudflare.com> | 2022-05-06 22:42:36 -0500 |
|---|---|---|
| committer | Joshua Nelson <jnelson@cloudflare.com> | 2022-06-19 15:54:31 -0500 |
| commit | 057eab7ae96ee491f8939e52722b6c29ce3cc445 (patch) | |
| tree | d8b0477f16cebc262e4177e4757f236405d02394 /compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp | |
| parent | b9eedea4b0368fd1f00f204db75109ff444fab5b (diff) | |
| download | rust-057eab7ae96ee491f8939e52722b6c29ce3cc445.tar.gz rust-057eab7ae96ee491f8939e52722b6c29ce3cc445.zip | |
Make "Assemble stage1 compiler" orders of magnitude faster
This used to take upwards of 5 seconds for me locally. I found that the
culprit was copying the downloaded LLVM shared object:
```
[22:28:03] Install "/home/jnelson/rust-lang/rust/build/x86_64-unknown-linux-gnu/ci-llvm/lib/libLLVM-14-rust-1.62.0-nightly.so" to "/home/jnelson/rust-lang/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libLLVM-14-rust-1.62.0-nightly.so"
[22:28:09] c Sysroot { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu(x86_64-unknown-linux-gnu) } }
```
It turned out that `install()` used full copies unconditionally. Change
it to use `copy()` internally, which uses hard links instead when
available.
Note that this has a change in behavior: Installing a file will also
change permissions on the source, not just the destination, if hard
links are used.
To avoid changing the behavior on symlinks for existing code, I
introduce a new function `copy_internal` which only dereferences
symlinks when told to do so.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
