From cf4ed969f90c6093895f33bbe80bab12b169dc2c Mon Sep 17 00:00:00 2001
From: Gilles Filippini <pini@debian.org>
Date: Fri, 5 May 2023 14:25:12 +0200
Subject: [PATCH] build: LTO profile 'thin' and moved to Cargo.toml

It makes more sense to set the release LTO profile into the related
Cargo.toml section than into the Dockerfile only.

Using LTO 'thin' profile because according to the documentation it is
a good compromise with no or little performance loss.
---
 Cargo.toml        | 1 +
 docker/Dockerfile | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index 7033f0bdc..42515b104 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -205,6 +205,7 @@ yamux = { opt-level = 3 }
 zeroize = { opt-level = 3 }
 
 [profile.release]
+lto = "thin"
 # Substrate runtime requires unwinding.
 panic = "unwind"
 
diff --git a/docker/Dockerfile b/docker/Dockerfile
index bb2f489c8..84b1b6af0 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -21,8 +21,7 @@ RUN test -x build/duniter || \
 ARG threads=1
 RUN test -x build/duniter || \
     ( \
-        CARGO_PROFILE_RELEASE_LTO="true" \
-            cargo build --release -j $threads && \
+        cargo build --release -j $threads && \
         mkdir -p build && \
         mv target/release/duniter build/ \
     )
-- 
GitLab