-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Compilation of curve25519-dalek is extremely slow with certain flags used by cargo-fuzz #95240
Comments
After some experimentation, this combination of flags alone results in about a 10× slowdown (60 seconds elapsed), but not the 100× for the full set of flags. I haven’t tried all permutations because it takes ~10 minutes every time.
|
Setting CGUs to 1 reduces parallelization opportunities, a 10x slowdown in wall-time wouldn't be surprising, but the user-time shouldn't go up significantly. The 50x increase in user-time probably comes from the other parameters. |
Some time ago I mentioned the same thing on the zulip, and the response was basically crickets and "that's expected" 🤷 https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/Compile.20time.20blowup.20associated.20with.20asan.3F/near/262968197 For what it's worth, I don't think this is okay, but I suspect that the real problem here is an interaction between address sanitizer and optimization passes. |
Any of these changes makes the slowdown smaller:
Here's a breakdown of the slowest combination from the OP: it seems to be coming from LLVM, so maybe opening an issue there could be interesting ? |
The project in which I discovered this depends on ~700 crates, and
Thanks for timing this. Yeah, that makes sense. Is there anything we can do to write a better bug report for LLVM? Dump the IR emitted by |
I’m not sure myself but maybe our LLVM expert @nikic could help answer such a question ? |
It seems that On my machine, with |
I hit this same issue and thanks to #95240 (comment) I was able to speed up fuzzer compilation drastically with run_fuzzer() {
CARGO_PROFILE_RELEASE_LTO=false \
CARGO_INCREMENTAL=0 \
cargo +nightly fuzz run "$1" -j4 -- -max_total_time="${2}" -print_final_stats=1
} And disabling LTO is due to rust-fuzz/cargo-fuzz#384 |
Compare these two, a normal
--release
compile ofcurve25519-dalek
3.2.0:And now with some particular flags (these are some of the flags that
cargo-fuzz
adds):It takes more than 100× as long as a regular release build. This time is spent compiling
curve25519-dalek
itself, the dependencies compile within seconds. I initially discovered this when trying to fuzz a package that transitively depends oncurve25519-dalek
. I haven’t yet tried to minimize the set of flags to see if there is one in particular that is the culprit.To reproduce, clone https://github.com/dalek-cryptography/curve25519-dalek and check out tag
3.2.0
. I’m running this on x86_64 Linux.Meta
rustc +nightly-2022-03-22 --version --verbose
:I can also reproduce with nightly 2022-03-15. I haven’t tried any others so far.
The text was updated successfully, but these errors were encountered: