Too long compile time with implementing a trait function
Open
@dianqk is already working on this.
Since Sep 29, 2024.
A-LLVM
C-bug
I-compiletime
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I found that implementing a specific trait function causes too long compile time.
If there is expression function implementation at https://github.com/veryl-lang/veryl/blob/3516e3c73a62a9d74301336a4cf7d11013445e57/crates/emitter/src/emitter.rs#L984 , compilation time is 1600s.
And if the implmentation is commented out, compilation time is 5s.
If codegen-units = 1 is specified, there is no problem.
The reproduce way is here:
git clone https://github.com/veryl-lang/veryl -b v0.12.0
cd veryl
git submodule update --init
sed -i 's/codegen/#codegen/' Cargo.toml
rm ./crates/parser/build.rs
# remove `expression` function implementation
sed -i '984,992d' ./crates/emitter/src/emitter.rs
# compile dependencies at first
cargo build --release --manifest-path crates/emitter/Cargo.toml
# There is not `expression` function implementation
# about 5s
touch ./crates/emitter/src/emitter.rs
time cargo build --release --manifest-path crates/emitter/Cargo.toml
# There is `expression` function implementation
# about 1600s
git checkout ./crates/emitter/src/emitter.rs
time cargo build --release --manifest-path crates/emitter/Cargo.toml
Meta
rustc --version --verbose:
rustc 1.80.1 (3f5fd8dd4 2024-08-06)
binary: rustc
commit-hash: 3f5fd8dd41153bc5fdca9427e9e05be2c767ba23
commit-date: 2024-08-06
host: x86_64-unknown-linux-gnu
release: 1.80.1
LLVM version: 18.1.7
Backtrace
<backtrace>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.