gluonhq / gluonfx-maven-plugin

Plugin that simplifies creating native images for Java/JavaFX maven projects
BSD 3-Clause "New" or "Revised" License
193 stars 40 forks source link

GraalVM vs client-maven-plugin - resulting binary size #42

Open woj-tek opened 5 years ago

woj-tek commented 5 years ago

I just compared resulting binaries size of one of the examples (https://github.com/gluonhq/client-samples/tree/master/Maven/HelloWorld - the most rudimentary single class):

client-maven-plugin produces whole .app bundle but still, the helloworld binary inside is 38884K ~ 37,97M.

What causes the discrepancy? I though that you are using graalvm to make those (from the output it seems you are using current development version 20). Is making output binaries smaller / on par with graalvm on your roadmap?

PS. is there some dedicated mailing-list or forum? Not sure it such general questions in the 'issues' section on github are ok.

woj-tek commented 5 years ago

OK, after some digging in:

wojtek@atlantiscity.local HelloWorld $ otool -L helloworld
helloworld:
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1575.17.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)

and client-maven-plugin:

wojtek@atlantiscity.local HelloWorld $ otool -L target/client/macos-x86_64/helloWorld.app/Contents/MacOS/helloWorld
target/client/macos-x86_64/helloWorld.app/Contents/MacOS/helloWorld:
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1575.17.0)
    /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1671.60.107)
    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 50.1.0)
    /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.11.0)
    /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 58286.255.3)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1575.17.0)

Would it be possible to use/select frameworks more selectively?

mbbee commented 4 years ago

Same here: HelloFx.exe (for Windows) has 57MB ...

woj-tek commented 4 years ago

Just tested it with the latest GraalVM (GraalVM CE 20.2.0 (build 11.0.8+10-jvmci-20.2-b03)) and plugin (<client.plugin.version>0.1.31</client.plugin.version>) and there is still discrepancy:

I also compared memory usage and:

What causes this discrepancy (in case of memory usage)? Are there any plans to slash it (would be nice to be able to use client-maven-plugin to easily build native images)

lilumat commented 8 months ago

Hello, any news about this ?