-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use same-file
to avoid unnecessary hard links
#4390
Conversation
This is targeted at removing the need for a workaround in rust-lang/rust#39518, allowing the main rust build system to move back to hard links which should be much more efficient.
r? @matklad (rust_highfive has picked a reviewer for you, use r? to override) |
Looks good to me. Sorry for not getting to this myself. |
No worries! I was halfway through thinking about the implementation and how to do it when I remembered the crate already existed :) |
bors r+ |
@bors r+ |
📌 Commit 599db09 has been approved by |
Use `same-file` to avoid unnecessary hard links This is targeted at removing the need for a workaround in rust-lang/rust#39518, allowing the main rust build system to move back to hard links which should be much more efficient.
In theory, it might be fun to think about comparing the contents of files as well, for potentially more fine grained caching, a-la compiler's red/green split: it might be the case that although inputs change, the result is the same. |
☀️ Test successful - status-appveyor, status-travis |
Heh I was actually just thinking about that yesterday as well! Definitely seems like a plausible idea! |
The `copy` function historically in rustbuild used hard links to speed up the copy operations that it does. This logic was backed out, however, in rust-lang#39518 due to a bug that only showed up on Windows, described in rust-lang#39504. The cause described in rust-lang#39504 happened because Cargo, on a fresh build, would overwrite the previous artifacts with new hard links that Cargo itself manages. This behavior in Cargo was fixed in rust-lang/cargo#4390 where it no longer should overwrite files on fresh builds, opportunistically leaving the filesystem intact and not touching it. Hopefully this can help speed up local builds by doing fewer copies all over the place!
rustbuild: Switch back to using hard links The `copy` function historically in rustbuild used hard links to speed up the copy operations that it does. This logic was backed out, however, in #39518 due to a bug that only showed up on Windows, described in #39504. The cause described in #39504 happened because Cargo, on a fresh build, would overwrite the previous artifacts with new hard links that Cargo itself manages. This behavior in Cargo was fixed in rust-lang/cargo#4390 where it no longer should overwrite files on fresh builds, opportunistically leaving the filesystem intact and not touching it. Hopefully this can help speed up local builds by doing fewer copies all over the place!
This is targeted at removing the need for a workaround in rust-lang/rust#39518,
allowing the main rust build system to move back to hard links which should be
much more efficient.