thepowersgang / mrustc

Alternative rust compiler (re-implementation)
MIT License
2.18k stars 109 forks source link

Reducing disk usage to bootstrap rustc #288

Open catap opened 2 years ago

catap commented 2 years ago

Right now build script never cleanup build artefacts from previous steps which increases disc usage.

Maybe it is possible to clean things up?

thepowersgang commented 2 years ago

Can you clarify which artefacts you feel could/should be automatically cleaned up? In general, they're kept around so that a failed build can be restarted cleanly... although that sometimes doesn't really apply.

catap commented 2 years ago

@thepowersgang I'm thinking about something like bootstrap-lean from gcc build. The idea of bootstrap-lean is remove all compiling objects after the step's artefact is ready. And when step's artefact doesn't required anymore => remove it also.

catap commented 2 years ago

What I'm thinking.

  1. output-1.54.0/rustc-build can be removed after output-1.54.0/rustc is ready (that reduces disk usage for more than 6Gb);
  2. output-1.54.0/cargo-build can be removed after output-1.54.0/cargo is ready (that reduces disk usage for more than 1Gb);
  3. output-1.54.0 can be removed after run_rustc/output-1.54.0/prefix/bin/cargo and run_rustc/output-1.54.0/prefix-s/bin/rustc is ready (that reduces disk usage for another ~0.8Gb)
  4. run_rustc/output-1.54.0/... can be removed then not needed.

To be honest (1) and (2) or just (3) makes huge win. Saves ~8Gb from ~14Gb of disk space usage.

What do you think?

thepowersgang commented 2 years ago

A good idea, but that's not something I'd like to add to the default scripts as it'd make debugging much slower.