Closed xMAC94x closed 2 years ago
So tarpaulin uses link-dead-code as a linker option because otherwise it doesn't detect unused functions in your own code. I don't think there's a way to specify a linker flag and not have it propagate to all the dependencies so this would mean all the unused parts of your dependencies can be linked in as well. I'd guess this is what creates the bloat.
Alternatively, I could look at removing the flag and using the source-analysis part of tarpaulin to identify every line you can hit but that's a significant amount of work and might not be robust against things like macros. I've been wondering for a while if that was a worthwhile route to take so I'll start to look towards prototyping something for it and let you know if I make some progress :+1:
Also side note you don't need RUSTFLAGS="--cfg procmacro2_semver_exempt"
for tarpaulin since proc macros reached stable so you can remove that unless it's needed for your own code to build.
Hi @xd009642 thank you for your answer, it helps me alot understanding what is going on (: I am looking forward to hear from you how prototyping works out. And thanks for the tip regarding the RUSTFLAGS ;) Have a nice evening
So I'm going to close this as inactive, but I am watching some RFCs on crate specific RUST_FLAGS which will dramatically reduce file sizes! Unfortunately my other experiments in this area didn't work
Hey devs, We did some tests in our CI, where we are doing `cargo check, build, test, bench, doc, release builds, and tarpaulin. We stored their caches in different directories:
with the following sizes
we noticed that tarpaulin allone uses 11GB, while all other builds, including check, build, test, bench, doc only take 5GB of space. And in this issue we wanted to ask if there is potential point of improvement. We know that tarpaulin ofc needs to add some information to the binaries in order to check the coverage, but lets go on:
we see 6 GB of dependencies and 4 GB of incremental builds
these big files in total are about 2581MB from 5.7 GB total.
I am wondering 2 things here:
The next question i have is:
lets compare witht he normal
cargo build
sizes:if we don't cover those libs, couldn'd we use the smaller file size version of them?
also when inspecting the
cache-tarpaulin/debug/incremental
directory i noticed that it has alot of duplicate folders: e.g.Some finishing words: Ofc we are aware that you are prob not the
cargo
guys and don't know all the internals. However whe are creating 20GB docker images in order to provide our runners with caches. And just wanted to ask for you to seek some optimizing potential, reducing it to like 16GB would already be a great win :) With that said: Have a nice day :)