Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to reduce the size of the compiled
dotter
binary. I'm taking your advice and including the final binary in my dotfiles but I thought the final binary size was a bit larger than I'd like. I followed the steps here and reduced the file size from 17M to 4.9M.This PR adds 5 new flags to the release profile in Cargo.toml:
strip = true
: strip symbolsopt-level = "z"
: optimize for file size instead of execution speed (more below)lto = true
: enable Link Time Optimizationcodegen-units = 1
: reduces parallel codegen units from 16 to 1panic = "abort"
: prevents unwinding the stack on a panic and prevents displaying a stacktraceThe
strip
andlto
optimizations have no downsizes but the others have some potential negative effects.Impact on File Size
Impact on Execution Time
opt-level
can potentially increase execution time. However, I benchmarkedcargo test --release
usinghyperfine
and found that there were almost no difference in test time.hyperfine "cargo test --release"
Impact on Build Time
codegen-units = 1
can slow down build times. In my testing, I was building from a clean repo for each run so build times are pretty long. But I think build times will be impacted much less when using cached builds.I'm not sure if there's any interest for this kind of PR but I thought I'd throw it out there. Thanks for you review.