Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
user defined lto rust based build packages
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3754

PostPosted: Tue Apr 23, 2024 6:15 pm    Post subject: user defined lto rust based build packages Reply with quote

Just succeeded lto-fat user defined built.
-10.92% binray shrink :lol: gui-apps/eww::guru

Build has big ram use though low on ressources here.
More tests required before publishing on how 2.

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "


Last edited by CaptainBlood on Thu Aug 01, 2024 8:11 am; edited 3 times in total
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3754

PostPosted: Tue Apr 23, 2024 7:52 pm    Post subject: Reply with quote

Another one with -11.04 :lol: media-sound/helvum

Thks 4 ur attention, interest & support
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "


Last edited by CaptainBlood on Tue Apr 23, 2024 9:35 pm; edited 1 time in total
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3754

PostPosted: Tue Apr 23, 2024 8:12 pm    Post subject: Reply with quote

Ouch +0.11 this time, building still :cry: app-shells/mcfly

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "


Last edited by CaptainBlood on Tue Apr 23, 2024 9:36 pm; edited 1 time in total
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3754

PostPosted: Tue Apr 23, 2024 9:31 pm    Post subject: Reply with quote

Okay,
It's all about adding the following to RUSTFLAGS:
Code:
-Clto=fat
-Cembed-bitcode=yes

packages referencing proc-macro* crates also require
Code:
-Zdylib-lto
here.
rust compiler requires it when needed.

Achieved with
Code:
dev-lang/rust
     Installed versions:  1.77.1(stable/1.77)^t(08:53:51 15/04/2024)(clippy doc miri nightly profiler rust-analyzer rust-src rustfmt system-bootstrap verify-sig wasm -big-endian -debug -dist -llvm-libunwind -lto -parallel-compiler -system-llvm -test ABI_MIPS="-n32 -n64 -o32" ABI_S390="-32 -64" ABI_X86="64 -32 -x32" CPU_FLAGS_X86="sse2" LLVM_TARGETS="WebAssembly X86 -AArch64 -AMDGPU -ARC -ARM -AVR -BPF -CSKY -DirectX -Hexagon -Lanai -LoongArch -M68k -MSP430 -Mips -NVPTX -PowerPC -RISCV -SPIRV -Sparc -SystemZ -VE -XCore -Xtensa")


Plz note some packages already have lto directive; some will have their size increased when adding as described above (e.g. sys-apps/fd)

Thks 4 ur attention, interest & support
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "


Last edited by CaptainBlood on Thu Aug 01, 2024 8:12 am; edited 1 time in total
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3754

PostPosted: Thu May 02, 2024 5:14 pm    Post subject: Reply with quote

gui-wm/niri::guru gains 14.27% here.

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3754

PostPosted: Tue Jul 23, 2024 7:40 pm    Post subject: Reply with quote

sys-apps/fd has tiny .1% size gain

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3754

PostPosted: Thu Aug 01, 2024 8:03 am    Post subject: Reply with quote

app-containers/aardvark-dns has a nice 18% shrink

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3600
Location: Rasi, Finland

PostPosted: Thu Aug 01, 2024 10:31 am    Post subject: Reply with quote

Have you measured compilation time and ram usage with these optimizations on and off?

And say, for example helvum, how much in bytes you save on disk?

I guess performance gains vary greatly between programs? ... If it's even measurable.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3754

PostPosted: Thu Aug 01, 2024 6:16 pm    Post subject: Reply with quote

Zucca wrote:
Have you measured compilation time and ram usage with these optimizations on and off?

No I'm focusing on binary size only.

Time shouldn't be 2 difficult to get.
No idea how to deal with compilation ram usage.
Tips welcome.

Zucca wrote:
And say, for example helvum, how much in bytes you save on disk?

About 12.51% size shrink.

Zucca wrote:
I guess performance gains vary greatly between programs? ... If it's even measurable.

No idea. Focusing on ram/disk savings.

Side note: jcc bug compensation here, which adds bytes on both sizes, expected to be of comparable amounts.
This jcc lowers the %.

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3600
Location: Rasi, Finland

PostPosted: Thu Aug 01, 2024 6:52 pm    Post subject: Reply with quote

CaptainBlood wrote:
Zucca wrote:
And say, for example helvum, how much in bytes you save on disk?

About 12.51% size shrink.
... and in bytes?
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3754

PostPosted: Thu Aug 01, 2024 9:15 pm    Post subject: Reply with quote

Zucca wrote:
CaptainBlood wrote:
Zucca wrote:
And say, for example helvum, how much in bytes you save on disk?

About 12.51% size shrink.
... and in bytes?

------------------
jcc mitigation:
lto no:
-rwxr-xr-x 1 root root 1104400 août 1 22:53 /usr/bin/helvum
lto:
-rwxr-xr-x 1 root root 981520 août 1 21:03 /usr/bin/helvum

size gain: (1104400-981520)*100/981520=12.51%
----------------------
jcc no mitigation:
lto no:
-rwxr-xr-x 1 root root 1092112 août 1 23:10 /usr/bin/helvum
lto:
-rwxr-xr-x 1 root root 961040 août 2 00:03 /usr/bin/helvum

size gain: (1092112-961040)*100/961040=13.63%
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3600
Location: Rasi, Finland

PostPosted: Fri Aug 02, 2024 11:04 pm    Post subject: Reply with quote

Seems like not worth for me.

Maybe for some SBC or embedded system at some corner cases. Of if I'd want to shrink my initramfs, which does not contain any rust packages at the moment anyways.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3754

PostPosted: Sun Aug 04, 2024 1:44 pm    Post subject: Reply with quote

Zucca wrote:
Seems like not worth for me.

Maybe for some SBC or embedded system at some corner cases. Of if I'd want to shrink my initramfs, which does not contain any rust packages at the moment anyways.
Sounds like your mind was made already, i.e. before my last post. :o

Side note:
At least rust build packages resulting in standalone static binaries may be good candidates for app-arch/upx compression.
Here are the numbers for the package you seemed concerned about:
Code:
acer /usr/bin # upx --ultra-brute helvum
                       Ultimate Packer for eXecutables
                          Copyright (C) 1996 - 2024
UPX 4.2.3       Markus Oberhumer, Laszlo Molnar & John Reiser   Mar 27th 2024

        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
    961040 ->    324620   33.78%   linux/amd64   helvum

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3600
Location: Rasi, Finland

PostPosted: Sun Aug 04, 2024 7:01 pm    Post subject: Reply with quote

I'm not really interested in any particular package. I'm just gathering some info for the future.
I've been putting together some initramfs based live environments (for rescue, file copying, dignostics). Size matter there when you have only, say, 2GB of RAM.

Still at the planning stage.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3754

PostPosted: Sun Aug 04, 2024 8:02 pm    Post subject: Reply with quote

Very out of topic:8)
Zucca wrote:
initramfs...
Still at the planning stage here for more than decade...:wink:
The main purpose I feel its need would be disk encryption...
But still feel very uncomfortable about how to & recovery.:roll:

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3754

PostPosted: Mon Aug 05, 2024 9:31 pm    Post subject: Reply with quote

First case where lto is bigger:
Code:
lto-no: -rwxr-xr-x 1 root root 11650080 août   6 00:08 /usr/bin/broot
lto:    -rwxr-xr-x 1 root root 11699232 août   6 00:22 /usr/bin/broot

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3754

PostPosted: Thu Aug 15, 2024 12:09 pm    Post subject: Reply with quote

CaptainBlood wrote:
-rwxr-xr-x 1 root root 961040 août 2 00:03 /usr/bin/helvum
rust 1.80.1 instead of 1.79.0 is improving:
Code:
-rwxr-xr-x 1 root root 932080 août  15 14:57 /usr/bin/helvum
Thks 4 ur attention , interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum