sigp / lighthouse

Ethereum consensus client in Rust
https://lighthouse.sigmaprime.io/
Apache License 2.0
2.97k stars 769 forks source link

lighthouse build dir is taking up too much space #4756

Open zhiqiangxu opened 1 year ago

zhiqiangxu commented 1 year ago

Yesterday I run out of space and at last I found:

67G /Users/xxx/Desktop/github/lighthouse

I'm also building many other rust projects, this is the largest I've seen so far...

michaelsproul commented 1 year ago

Yeah with incremental compilation enabled it can get really big really fast. I'm not sure why Lighthouse would be larger than other projects you're working on, but we do have a lot of dependencies (around 1300). Our use of monomorphization for different EthSpec types also blows up the amount of code generated.

Usually I just run cargo clean periodically. You can always run it when updating Rust, because the old artefacts won't work with the new compiler anyway.

You could also try disabling incremental compilation with CARGO_INCREMENTAL=0, but this will make the build time a lot longer.

zhiqiangxu commented 1 year ago

Thanks for the tips, I've been using rustc 1.67.0-nightly (ff8c8dfbe 2022-11-22) for a while, and here're some other project sizes for comparison:

9.1G    /Users/xxx/Desktop/github/snarkOS
 12G    /Users/xxx/Desktop/github/snarkVM
5.5G    /Users/xxx/Desktop/github/rust-fil-proofs
1.1G    /Users/xxx/Desktop/github/halo2
2.9G    /Users/xxx/Desktop/github/zkWasm
1.9G    /Users/xxx/Desktop/github/Nova
1.2G    /Users/xxx/Desktop/github/leo
 10G    /Users/xxx/Desktop/github/builtin-actors
jmcph4 commented 1 year ago

@zhiqiangxu Any progress on this? Did disabling incremental compilation help at all? Funnily enough, I was perusing my own Rust build directories (for Lighthouse and otherwise) and realised just how large they can get.

zhiqiangxu commented 1 year ago

Didn't try yet, as compilation is automatically triggered by IDE, vscode in my case.