Skip to content

Conversation

@hellojason3
Copy link
Collaborator

Description:

This PR addresses the issue of excessively long compilation times for the starknet_with_keccak layout in the release build on certain machines. For instance, on an Intel 13900H, the compilation time was observed to be 259 minutes.

Problem:

The exact cause of the issue is unclear, but it was found that reducing the number of clone operations in the starknet_with_keccak/autogenerated.rs file significantly decreases the compilation time.

Here are some logs when we compiled.

Rust version: nightly-2024-09-17
Compilation time was measured using the command:

RUSTFLAGS="-Z time-passes" cargo build --release --features starknet_with_keccak --no-default-features

Below is the compilation log for the Intel 13900H:

time:   0.897; rss:  300MB ->  571MB ( +271MB)  codegen_to_LLVM_IR
time:   1.307; rss:  161MB ->  571MB ( +410MB)  codegen_crate
time:   0.028; rss:  571MB ->  470MB ( -101MB)  free_global_ctxt
time: 15518.330; rss:  366MB -> 1436MB (+1070MB)        LLVM_passes
time:   0.006; rss: 1316MB ->  715MB ( -602MB)  join_worker_thread
time: 15517.532; rss:  471MB ->  672MB ( +202MB)        finish_ongoing_codegen
time:   0.000; rss:  670MB ->  644MB (  -26MB)  link_binary_check_files_are_writeable
time:   0.173; rss:  514MB ->  515MB (   +1MB)  run_linker
time:   0.179; rss:  670MB ->  515MB ( -155MB)  link_binary
time:   0.180; rss:  670MB ->  515MB ( -155MB)  link_crate
time: 15517.712; rss:  471MB ->  515MB (  +44MB)        link
time: 15519.097; rss:   32MB ->  490MB ( +458MB)        total
    Finished `release` profile [optimized] target(s) in 259m 20s

Solution:

We have undertaken extensive work to reduce the number of clone operations. The results are significant, with the release build time now reduced to approximately 3 minutes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants