Lib size almost does not change when doing custom build on iOS compared to Android

Hi Folks,

On master branch when doing custom build for Android I have got 40% decrease in Lib size (for However when doing custom build for iOS with the same .yaml file I have got about 2.7% decrease (for libtorch_cpu.a).
I did custom builds as described here:

I have also created following GitHub issue:


@hhov The size reduction happens when you link your static libraries to output the final binary, as linker can strip most of the unused code ( -dead_strip ). Unlike dynamic libraries(.so in Android), linker can’t strip code when compiling static libraries.

@xta0 Thanks for info. Besides comparing .a file sizes I also checked size as described here:
Both ways gave insignificant difference. I tried also with -dead_strip but seams XCode is already doing it.
After that I tried simply comparing final .ipa files and result was as expected, about 40% decrease in size.

1 Like