JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.52k stars 1.13k forks source link

DLL files in Windows installer or distributable can be shrunk by over 20 MB #3593

Open mahozad opened 10 months ago

mahozad commented 10 months ago

Using UPX tool, size of skiko-windows-x64.dll file (generated in <APP_DIRECTORY>/app/) can be reduced from 16.2 MB to 5.2 MB.
A reduction of about 11 MB which is a large amount in my opinion.

I also executed UPX on the Java DLL files (in <APP_DIRECTORY>/runtime/) and the total size reduced from about 61 MB to about 51 MB (for JDK 17). So, overall, the app uncompressed size reduced by about 21 MB.

The tool says it can be used for Linux and macOS executables as well.

Please consider including running UPX in the Gradle tasks that generate the installer or distribution.

UPX promises its results to run exactly as before, but if you think this might introduce subtle or hard-to-detect bugs, please provide an option in compose.desktop { // ... block for the programmer to be able to enable/disable this feature.

m-sasha commented 10 months ago

@igordmn @AlexeyTsvetkov What do you think? I don't know if we can use a 3rd party library in our distribution-building, but maybe we can mention it as an option in the tutorial.

igordmn commented 10 months ago

Before mentioning/supporting UPX, we should investigate advantages/disadvantages of it. Unpacking the compressed skiko binary in runtime theoretically can slow down the startup.

As for using 3rd party tools - it is possible to integrate them into the Compose Plugin, if the license allows it, the tool is stable and it won't cause much burden for supporting it.

apolostudio commented 2 weeks ago

@mahozad Have you encountered any critical issues when using it? I want to reduce an app's size and im looking for even the smallest optimization. Thanks!

mahozad commented 2 weeks ago

So far, no issue for the app that I'm aware of.

okushnikov commented 1 week ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.