https://kotlinlang.org logo
#compose
Title
# compose
t

Tolriq

12/09/2023, 9:15 AM
Seems in compose 1.7 ui-graphics now depends on graphic-path that includes huge .so files. Any plans to try to reduce the sizes if they are mandatory now? 340K for ARMV8 is huge given the small code. (No log link, MinSizeRel) ?
r

romainguy

12/09/2023, 5:37 PM
The .so shouldn't be so big indeed. I'll look into this, thanks for raising this problem
t

Tolriq

12/09/2023, 5:43 PM
Thanks from a French compatriot 🙂
r

romainguy

12/09/2023, 5:44 PM
Did you try a release build btw? AGP should do pretty aggressive symbols removal
t

Tolriq

12/09/2023, 5:44 PM
It is on release builds, I carefully check aab size in CI.
r

romainguy

12/09/2023, 5:44 PM
Thanks
t

Tolriq

12/09/2023, 5:45 PM
Seems there's a very huge .text in the .so I suppose it's built with a recent NDK?
There was a lot of size regressions after 22.
https://github.com/android/ndk/issues/1402 Maybe your example will give them enough data to report to upper project.
r

romainguy

12/09/2023, 5:51 PM
This reminds me of how much I dislike the C++ stdlib
t

Tolriq

12/09/2023, 5:53 PM
not linking with log, tweaking -Os or forcing MinSizeRel that is not the default should already help a lot, but yes I hate the very little control we have 🙂
r

romainguy

12/09/2023, 5:54 PM
Based on what I'm reading in the bug reports it doesn't seem -Os will help that much
t

Tolriq

12/09/2023, 5:55 PM
Not for that bug no, but I'm not sure this is the main or the only issue here, just pointing that issue due to the big .text, but there's maybe room to gain on the rest too.
r

romainguy

12/09/2023, 5:55 PM
But yeah liblog shouldn't be linked in release
t

Tolriq

12/09/2023, 5:56 PM
Yes I've seen I use nearly the same.
r

romainguy

12/09/2023, 5:56 PM
I'll fix that
And this library can probably not use libc++ at all
t

Tolriq

12/09/2023, 5:58 PM
Well I did not dig that down I'll leave you the fun 😛
r

romainguy

12/11/2023, 9:15 PM
alright, I shaved off 150 KiB
doing more would require ditching the stdlib entirely it seems
And another 10 KiB
Hmm seems I’m down to 14 KiB total
t

Tolriq

12/12/2023, 7:30 AM
Wow, nice change indeed. Seeing the PR the last iteration is just about removing stdlib something I can't do. Do you have some details about what you did for the first 150k in case there's some trickery I can reuse?
r

romainguy

12/12/2023, 8:05 AM
Yes. The first 150 KiB were won by doing something I should have done in the first place for safety: marking all symbols but JNI_OnLoad as local so they can be removed by the stripping step
I saved another 10 KiB by ditching call_once and std_vector. I was left with only one call to "new" as an stdlib non-header-only call and that's enough to bring exceptions and libunwind 😕
Actually just linking libstdc++ seems enough. I guess static initializers are to blame?
t

Tolriq

12/12/2023, 9:44 AM
Thanks a lot, I missed the already merged parts, will look them in details. And thanks for the work on that .so really appreciated.