Using UniFFI on desktop often bloats the installer size
Categories
(Toolkit :: UniFFI Bindings, defect, P2)
Tracking
()
People
(Reporter: markh, Unassigned)
References
Details
eg, landing tabs caused bug 1798266, converting webext-storage to use uniffi caused bug 1939022. We probably need to avoid this happening for every new component, and ideally work out how to address the 2 mentioned.
Comment 1•2 months ago
|
||
Sorry about the duplicate above. Just adding one more for webext-storage. If I am mistaken, feel free to undo.
Comment 2•1 month ago
|
||
I did a bit of digging on why this is. The result is I have no idea, but I don't think it's UniFFI directly.
readelf
does a pretty good job at listing symbols and their sizes. On my machine readelf --syms obj-x86_64-pc-linux-gnu/dist/bin/libxul.so -W | grep -i webext
prints out a lot of symbols, including:
- UniFFI generated scaffolding:
uniffi_webext_storage_checksum_method_webextstoragebridgedengine_sync_finished
) - UniFFI metadata:
UNIFFI_META_UDL_WEBEXTSTORAGE
(there's not a lot here since webext storage uses UDL). - Rust functions:
_ZN14webext_storage4sync6bridge26WebExtStorageBridgedEngine12set_uploaded17hf65181f31073eee9E
- uniffi-bindgen-gecko-js generated code:
_ZN7mozilla6uniffi72ScaffoldingCallHandlerUniffiWebextStorageFnMethodWebextstoragestoreClearD0Ev
Estimated sizes
- All UniFFI generated symbols: ~34k
- uniffi-bindgen-gecko-js symbols: ~19k
- Rust symbols: ~71K
- I took a look and saw that the metadata for suggest was about 11k
Methodology
I started each shell pipeline with readelf --syms obj-x86_64-pc-linux-gnu/dist/bin/libxul.so -W | grep -i uniffi
I ended each with | awk -F' ' '{sum+=$3;} END{print sum;}'
In the middle was an extra grep filter:
- Rust symbols:
grep 'ZN.*webext'
(I'm somewhat confident I got this right, but I might be missing something) - UniFFI:
grep -i uniffi
- Then I noticed that some of our symbols have the form
ffi_*
. I used ingrep ' ffi_webext_storage
to capture those.
- Then I noticed that some of our symbols have the form
- Rust symbols: Filtered using
grep 'mozilla.*uniffi'
Conclusions
- I don't think the UniFFI generated code was a significant contributor to this size increase.
- Stripping metadata symbols would give us a free win (if this isn't already happening somewhere further down the pipeline)
- The size of the generated C++ code is somewhat significant and it would be nice to lower this.
Description
•