Add production-stripped cargo profile (#32651)

* Add production-stripped cargo profile

Stripping the binary significantly reduces the size
significantly (in my tests to about 1/3 of the original size).
Enabling lto and setting `codegen-units = 1` allows further size
optimizations at the cost of increased compile-time.

Probably not everyone wants a stripped binary, since it makes
backtraces less useful.

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* Move lto and cgu option to production profile

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

---------

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
This commit is contained in:
Jonathan Schwender 2024-07-02 15:05:24 +02:00 committed by GitHub
parent 7b324074b5
commit bd0a5eb4b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -152,6 +152,12 @@ debug-assertions = true
[profile.production]
inherits = "release"
debug-assertions = false
lto = "thin"
codegen-units = 1
[profile.production-stripped]
inherits = "production"
strip = true
[patch.crates-io]
# If you need to temporarily test Servo with a local fork of some upstream