slow compilation of large struct with Box
-members and ?
in field init
#93257
Labels
A-box
Area: Our favorite opsem complication
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-bug
Category: This is a bug.
I-compiletime
Issue: Problems and improvements with respect to compile times.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Uh oh!
There was an error while loading. Please reload this page.
I'm generating some large struct and reduced it to a very specific sample.
Here's the code:
https://github.com/M1cha/rust-bugs/tree/slowcomp-large-struct
So basically I have a single large struct that looks like this
and an impl like this:
With 400 fields, this compiles for 54s on my machine.
There's a lot of things that will make that code compile fast(<2s):
usize
,()
),Vec
takes a long time as wellstd::io::Result
and return theBox
directlyload
privateunwrap
instead of?
Meta
rustc --version --verbose
:This also happens on this nightly:
So I've run
RUSTFLAGS="-Z self-profile" cargo +nightly build
and this is the output of
summarize summarize
:self-profile
So either this is a LLVM code generation bug or rustc just generates a lot of code.
target/debug/libslowcomp.rlib
is 11MiB in size for 400 fields.The text was updated successfully, but these errors were encountered: