Commit 057eab7
committed
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.1 parent b9eedea commit 057eab7
2 files changed
+20
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1873 | 1873 | | |
1874 | 1874 | | |
1875 | 1875 | | |
1876 | | - | |
1877 | 1876 | | |
1878 | 1877 | | |
1879 | 1878 | | |
| |||
1983 | 1982 | | |
1984 | 1983 | | |
1985 | 1984 | | |
| 1985 | + | |
| 1986 | + | |
1986 | 1987 | | |
1987 | 1988 | | |
1988 | 1989 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1408 | 1408 | | |
1409 | 1409 | | |
1410 | 1410 | | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
1411 | 1415 | | |
1412 | 1416 | | |
1413 | 1417 | | |
| |||
1417 | 1421 | | |
1418 | 1422 | | |
1419 | 1423 | | |
| 1424 | + | |
1420 | 1425 | | |
1421 | | - | |
1422 | | - | |
1423 | | - | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
1424 | 1435 | | |
1425 | 1436 | | |
1426 | 1437 | | |
1427 | 1438 | | |
1428 | | - | |
| 1439 | + | |
1429 | 1440 | | |
1430 | 1441 | | |
1431 | 1442 | | |
| |||
1497 | 1508 | | |
1498 | 1509 | | |
1499 | 1510 | | |
1500 | | - | |
1501 | | - | |
1502 | | - | |
1503 | | - | |
1504 | | - | |
1505 | | - | |
1506 | | - | |
1507 | | - | |
1508 | | - | |
1509 | | - | |
1510 | | - | |
1511 | | - | |
1512 | | - | |
| 1511 | + | |
| 1512 | + | |
1513 | 1513 | | |
| 1514 | + | |
1514 | 1515 | | |
1515 | 1516 | | |
1516 | 1517 | | |
| |||
0 commit comments