Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Other Things Gentoo
  • Search

user defined lto rust based build packages

Still need help with Gentoo, and your question doesn't fit in the above forums? Here is your last bastion of hope.
Post Reply
Advanced search
18 posts • Page 1 of 1
Author
Message
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

user defined lto rust based build packages

  • Quote

Post by CaptainBlood » Tue Apr 23, 2024 6:15 pm

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.
Last edited by CaptainBlood on Thu Aug 01, 2024 8:11 am, edited 3 times in total.
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. "
Top
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

  • Quote

Post by CaptainBlood » Tue Apr 23, 2024 7:52 pm

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

Thks 4 ur attention, interest & support
Last edited by CaptainBlood on Tue Apr 23, 2024 9:35 pm, edited 1 time in total.
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. "
Top
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

  • Quote

Post by CaptainBlood » Tue Apr 23, 2024 8:12 pm

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

Thks 4 ur attention, interest & support.
Last edited by CaptainBlood on Tue Apr 23, 2024 9:36 pm, edited 1 time in total.
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. "
Top
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

  • Quote

Post by CaptainBlood » Tue Apr 23, 2024 9:31 pm

Okay,
It's all about adding the following to RUSTFLAGS:

Code: Select all

-Clto=fat
-Cembed-bitcode=yes
packages referencing proc-macro* crates also require

Code: Select all

-Zdylib-lto
here.
rust compiler requires it when needed.

Achieved with

Code: Select all

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
Last edited by CaptainBlood on Thu Aug 01, 2024 8:12 am, edited 1 time in total.
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. "
Top
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

  • Quote

Post by CaptainBlood » Thu May 02, 2024 5:14 pm

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. "
Top
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

  • Quote

Post by CaptainBlood » Tue Jul 23, 2024 7:40 pm

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. "
Top
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

  • Quote

Post by CaptainBlood » Thu Aug 01, 2024 8:03 am

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. "
Top
Zucca
Administrator
Administrator
User avatar
Posts: 4698
Joined: Thu Jun 14, 2007 10:31 pm
Location: Rasi, Finland
Contact:
Contact Zucca
Website

  • Quote

Post by Zucca » Thu Aug 01, 2024 10:31 am

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 :..

Code: Select all

init=/sbin/openrc-init
-systemd -logind -elogind seatd
I am NaN! I am a man!
Top
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

  • Quote

Post by CaptainBlood » Thu Aug 01, 2024 6:16 pm

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. "
Top
Zucca
Administrator
Administrator
User avatar
Posts: 4698
Joined: Thu Jun 14, 2007 10:31 pm
Location: Rasi, Finland
Contact:
Contact Zucca
Website

  • Quote

Post by Zucca » Thu Aug 01, 2024 6:52 pm

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 :..

Code: Select all

init=/sbin/openrc-init
-systemd -logind -elogind seatd
I am NaN! I am a man!
Top
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

  • Quote

Post by CaptainBlood » Thu Aug 01, 2024 9:15 pm

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. "
Top
Zucca
Administrator
Administrator
User avatar
Posts: 4698
Joined: Thu Jun 14, 2007 10:31 pm
Location: Rasi, Finland
Contact:
Contact Zucca
Website

  • Quote

Post by Zucca » Fri Aug 02, 2024 11:04 pm

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 :..

Code: Select all

init=/sbin/openrc-init
-systemd -logind -elogind seatd
I am NaN! I am a man!
Top
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

  • Quote

Post by CaptainBlood » Sun Aug 04, 2024 1:44 pm

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: Select all

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. "
Top
Zucca
Administrator
Administrator
User avatar
Posts: 4698
Joined: Thu Jun 14, 2007 10:31 pm
Location: Rasi, Finland
Contact:
Contact Zucca
Website

  • Quote

Post by Zucca » Sun Aug 04, 2024 7:01 pm

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 :..

Code: Select all

init=/sbin/openrc-init
-systemd -logind -elogind seatd
I am NaN! I am a man!
Top
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

  • Quote

Post by CaptainBlood » Sun Aug 04, 2024 8:02 pm

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. "
Top
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

  • Quote

Post by CaptainBlood » Mon Aug 05, 2024 9:31 pm

First case where lto is bigger:

Code: Select all

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. "
Top
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

  • Quote

Post by CaptainBlood » Thu Aug 15, 2024 12:09 pm

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: Select all

-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. "
Top
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

  • Quote

Post by CaptainBlood » Sat Nov 16, 2024 8:00 pm

app-shells/nushell is another one with 18.79% size decrease.

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. "
Top
Post Reply

18 posts • Page 1 of 1

Return to “Other Things Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic