garikello3d / bigarchiver

Backup and restore big amounts of data with advanced encryption and integrity protection
MIT License
3 stars 1 forks source link

cargo.toml: reduce release binary size by 10x #5

Closed waynr closed 10 months ago

waynr commented 10 months ago

The new release profile options do the following:

For me this took the binary size down from 7MB to roughly 682KB.

garikello3d commented 10 months ago

well, for some reason I thought the LTO is enable by default for Rust release build. Looks it is indeed enabled in some "thin" mode if not specified. But I agree that "fat" LTO is good to have, I don't care if my compile time jumps from 20 to 40 seconds.

regarding the stripping, I didn't enable it since it makes analysis of crashdumps impossible, as the stack trace will lack function names. I don't know how valuable to know in Rust ecosystem what is the stack trace my program crashed with.

@waynr what do you think?

waynr commented 10 months ago

@waynr what do you think?

I think it's reasonable to produce both a small binary (with debug symbols) for target environments that require it and a large binary (without debug symbols) for target environments that can tolerate tolerate it. These can both be built as part of an automated release pipeline; something I neglected to suggest in #4 was some kind PR pipeline for validating changes as they come in (eg run tests, validate different rust toolchain builds and platform targets) and an on-merge pipeline that handles all the necessary build and release activities.