-
Notifications
You must be signed in to change notification settings - Fork 439
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
Issues with releasing and reacquiring implicit jobserver token #858
Comments
Yeah that is a really unfortunate situation. NOTE that if any I'm really not sure how to fix this. |
osiewicz
added a commit
to zed-industries/zed
that referenced
this issue
Nov 13, 2023
This resolves a minor issue where build scripts could've acquired more job server tokens from Cargo than allowed by `-j` parameter. I've filled a PR at rust-lang/cc-rs#878 and we've iterated on the design over there since. TL;DR: some build scripts may complete a tad bit quicker, potentially shaving off a few seconds off of debug/release builds. Full description of the issue is available in rust-lang/cc-rs#858 Release Notes: - N/A
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was trying to optimize build times and found that -sys crate dependencies seemed to be taking a long time according to the
cargo build --timings
output. Further investigation showed that these dependencies didn't take as long to build in isolation (with concurrency controlled for with-j1
), which seemed odd.More investigation led to rust-lang/cargo#7689 and rust-lang/cargo#7344 being the culprits.
Long story short, I think that releasing and reacquiring the implicit jobserver token causes the
cargo build --timings
output to be misleading.Take this example:
And the resulting graph:
If I build each of the -sys dependencies in isolation, bzip2-sys takes ~0.5s, nng-sys takes ~14s, and zstd-sys takes ~15s. Note the inconsistency with the graph.
What appears to be happening, roughly, in this case is:
If you assume this is more or less what happened, the bars in the graph make sense and the timings are consistent with how long the -sys crates take to build in isolation.
Also, I don't know how cargo schedules dependency building, but I'm wondering if this issue could cause increases in compile times by delaying builds of dependents in an unexpected way. If cargo specifically chooses to compile one dependency earlier to unlock its ability to start compiling dependents, presumably with the goal of reducing overall build time, then I think this choice might be undermined by the behavior seen here, since we see other crates sort of cut in line.
I'm also wondering if, once this is fixed, the change introduced by rust-lang/cargo#7344 should be reverted or modified somehow, or if doing so would cause problems with older versions of cc on older versions of cargo.
The text was updated successfully, but these errors were encountered: