On 2022-09-13 11:54, Nuno Teixeira wrote:

Hi,

I think this issue is related to what happened in terms of optimizations in go 1.18.3_1: ---
Add amd64 microarchitecture level knobs for the Go compiler. Note that
this will affect only the compiler itself, port users will still need to
set GOAMD64 in the environment to adjust the microarchitecture of the
compiled code
---
I've found this optimizations interesting, e.g.:
---
The current high level steps to reduce binary size are:

* Use Rust 1.32.0 or newer (which doesn't include jemalloc by default)
* Add the following to Cargo.toml [2]:

[profile.release]
opt-level = 'z'     # Optimize for size.
lto = true          # Enable Link Time Optimization
codegen-units = 1 # Reduce number of codegen units to increase optimizations.
panic = 'abort'     # Abort on panic
strip = true        # Strip symbols from binary*

*strip = true requires Rust 1.59+. On older Rust versions, run strip manually on the resulting binary.
---

I was searching for cargo stripping instead of using STRIP_CMD and I found this but this means that we have to hack ports Cargo.toml's or should be upstream to implement a [profile.release]?

Cheers,

Mark Millard <mark...@yahoo.com> escreveu no dia sábado, 10/09/2022 à(s) 12:53:

Daniel Engberg <diizzy_at_FreeBSD.org> wrote on
Date: Sat, 10 Sep 2022 09:45:21 UTC :

Since there is work and general interest regarding optimization would it
make sense to make LTO and possibly CODEGEN_UNITS=1 opt-out while we
still have a fairly manageable amount of ports using Rust?

Just making sure I understand the wording:

So, in part, you are requesting that the FreeBSD build servers build
using LTO and CODEGEN_UNITS=1? (Those build servers always use the
defaults as I understand. Thus, the defaults are set to what is
desired for use on the build servers, if I understand right. Other
contexts that happen to want something different override some
default(s): opt out of the defaults.)

===
Mark Millard
marklmi at yahoo.com [1]

--

Nuno Teixeira
FreeBSD Committer (ports)

Hi,

The suggestion is to make it default for all ports but we can (and should) make it opt-out as not all outcomes might be favourable.
These are ENV variables so one wouldn't need to touch induvidual ports.

Best regards,
Daniel



Links:
------
[1] http://yahoo.com
[2] https://doc.rust-lang.org/cargo/reference/manifest.html

Reply via email to