To Pack or not to Pack?
By Rakesh Menon on Oct 26, 2009
I'm back from vacation.. Hmm.. well it was not this long though.. (my last post was more than a month back).. I traveled to few places, exploring new things.. You may view the some of the photos here!
Anyway back to the topic.. Is it always good to compress the jar while deploying the Java/JavaFX application? What will be its impact on startup time? Or may be I was doing too much pack and unpack of luggage during vacation and hence the thought is still lingering in my mind?!
I think the answer depends on the application and target users. Pack helps to compress the jar file size (reduce download time). But it may increase the start-up time due to additional step - unpack. So if the application is too small, it may be better not to use compressed jar. Also if the target audience has very good bandwidth, then user may not see the benefit of reduced download time.
|Applet - Pack||Applet - No-Pack|
|<script src="http://dl.javafx.com/1.2/dtfx.js"></script> <script src="/rakeshmenonp/resource/Startup/Startup.js"></script>||<script src="http://dl.javafx.com/1.2/dtfx.js"></script> <script src="/rakeshmenonp/resource/StartupNoPack/Startup.js"></script>|
Note: Above example is not the best to demonstrate any significant difference in warm start-up time
Also set update check to background in jnlp files as shown below.. Please refer to tech tip on start-up time for more information.
JavaFX packager was generating jnlp files with missing / for close tag for applet-desc - param tag. Due to this any subsequent tags were getting ignored. So we need to ensure that all tags are properly closed. This issue with javafxpackager is resolved (not be available in 1.2)
Best way to validate the jnlp is to launch the application and view the jnlp in Java Cache Viewer. Ensure that all entries are reflected properly. Update check must be set to "background" and not "timeout".
Well.. I never thought that one character (or lack of it) can contribute so much towards start-up time! Keep exploring!!