rust-lang / rust-lang/rust

MIR_borrow_checking and MIR_effect_checking are very slow

Open
#126,440 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-borrow-checker A-MIR C-bug E-needs-mcve I-slow T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried this code:

https://git.libre-chip.org/libre-chip/fayalite/src/commit/25aa90ec603acdc49a984588e75ba62d7f16b5c4

I expected to see this happen: compile in a reasonably short time

Instead, this happened:
running cargo +nightly rustc -p fayalite -- -Z time-passes gives small times for everything except:

time:  25.136; rss:  396MB ->  782MB ( +386MB)  MIR_borrow_checking
time:  22.335; rss:  782MB ->  973MB ( +191MB)  MIR_effect_checking

I'm running on a Ryzen 9 7950X so this isn't just a slow cpu.

Meta

rustc --version --verbose:

rustc 1.81.0-nightly (8337ba918 2024-06-12)
binary: rustc
commit-hash: 8337ba9189de188e2ed417018af2bf17a57d51ac
commit-date: 2024-06-12
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7

compilation is also quite slow on 1.79.0 stable, using RUSTC_BOOTSTRAP=1 cargo rustc -p fayalite -- -Z time-passes:

time:  24.300; rss:  389MB ->  768MB ( +379MB)  MIR_borrow_checking
time:  21.751; rss:  768MB ->  958MB ( +191MB)  MIR_effect_checking

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Fayalite example at the linked commit with the shown cargo +nightly rustc and RUSTC_BOOTSTRAP=1 commands, using -Z time-passes. Start by profiling MIR_borrow_checking and MIR_effect_checking; done means identifying and resolving the reported compilation-time and memory costs on the stated stable and nightly versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, performance
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.