Replies: 1 comment 1 reply
-
Hey, last time I checked most of the size came from Skia, which I don't think I can do much about it.
Is it possible to know what libraries?
You could try bundling your app using |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For the minimal project below, I could confirm that the
cargo build --release
binary size is no less than 20MB under Linux-x64After inspecting the output file, I could confirm that
.rodata
section is taking up the largest amount of the file size followed by the.text
sectionobjdump target/release/freya-intro --headers --section .text
objdump target/release/freya-intro --headers --section .rodata
Followed by that, I used
upx
to reduce the final binary size even furtherupx --best --overlay=strip -o target/release/freya-intro-compressed target/release/freya-intro
Unfortunately, It's having a negative side effect on RAM usage (already doubling)
After that, I had to
objdump
content for both.text
and.rodata
sections for further inspectionAnd I could confirm that
.rodata
is containing several occurrences of useless textual data which should be useful when debugging due to some absolute paths referencing the development machine(e.g: /home/username/.cargo/registry/src/index.crates.io-.......)
I conclude that some unnecessary content related to development is getting linked into the
.rodata
section of the release build, and discarding it may help reduce both the final binary size and even ram usage.I understand that content inside
.rodata
section should be discarded before the link step. probably some inner libraries are keeping this content regardless of release build optimizations.Question: How to get rid of the extra content and reduce the final binary size even further by a large margin?
Beta Was this translation helpful? Give feedback.
All reactions