release optimization

This optimization is not only for size but also runtime. Who doesn't want to use less CPU cycles? ;-)

Since releases are not done that often and usually via build machines and pipelines, I don't see it as an issue that the build time doubled.

| Description         | Change | Before   | After     |
|---------------------|--------|----------|-----------|
| Build time          | +110%  | 5min 31s | 11min 34s |
| Binary size (bytes) |  -42%  | 49466432 | 28576480  |

Build command: `cargo build --features sqlite,mysql,postgresql --release`
This commit is contained in:
Helmut K. C. Tessarek 2023-07-03 16:06:27 -04:00
parent 19e671ff25
commit 4fa4600e11
No known key found for this signature in database
GPG Key ID: BE0985349D44DD00

View File

@ -168,10 +168,14 @@ rocket = { git = 'https://github.com/SergioBenitez/Rocket', rev = 'ce441b5f46fdf
# rocket_ws = { git = 'https://github.com/SergioBenitez/Rocket', rev = 'ce441b5f46fdf5cd99cb32b8b8638835e4c2a5fa' } # v0.5 branch
# Strip debuginfo from the release builds
# Also enable thin LTO for some optimizations
# Also enable fat LTO, opt-level 3, codegen-units 1 for best optimization
[profile.release]
strip = "debuginfo"
lto = "thin"
opt-level = 3
debug = false
panic = "unwind"
lto = true
codegen-units = 1
strip = true
# Always build argon2 using opt-level 3
# This is a huge speed improvement during testing