Skip to content

Compress target directory files #16462

@A4-Tacks

Description

@A4-Tacks

The compilation products of Rust often make the target directory very large

If compressed after compilation, sacrificing some speed can significantly reduce space usage

I hope to have an unstable feature to compress intermediate files and decompress them during use

$ cargo clean
     Removed 0 files
$ cargo test -p ide-assists -- -q
   Compiling proc-macro2 v1.0.101
...
test result: ok. 2644 passed; 0 failed; 3 ignored; 0 measured; 0 filtered out; finished in 16.80s

$ du -sh target
3.0G    target
$ cargo check -p ide-assists
    Checking once_cell v1.21.3
    Checking ide-db v0.0.0 (/rust-analyzer/crates/ide-db)
...
    Checking ide-assists v0.0.0 (/rust-analyzer/crates/ide-assists)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1m 02s
$ du -sh target
3.3G    target
$ find target -type f -exec gzip {} +
$ du -sh target
883M    target

Possible problem

  • Compression and decompression have worsened disk IO
  • The lifetime of temporarily decompressed files
  • May not be aware of compiler requests for intermediate files
  • Is it worthwhile to introduce a compression algorithm library into cargo dependencies
  • Is the hard link file compressed

@rustbot label +C-feature-request

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cachingArea: caching of dependencies, repositories, and build artifactsC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions