Here is a conversation I started with Micha on Slack that I wanted to be able to document and organize somewhere so I’m moving it to Discourse.
=============================================
On the topic of size again… I noticed that my CommandBox 4 builds are twice the size as CommandBox 3. (note the other day I was talking about the size of the Lucee server context after it starts up, here I’m just talking about the size of the box.exe
binary itself). We use pack200 to highly compress all of the jar files in CommandBox and at first I thought I just forgot to run that process, but tested it today and realized that pack200 is running but it’s just not doing anything to the Lucee jar! It turns out pack200 will only compress the bytecode parts of the jars, but the way we’re building the Lucee 5 with all the extensions, bundles, and the lco file added into it, pack200 doesn’t touch any of those binaries. This is a big issue for us as it’s made the box.exe
go from ~37 Megs to ~75 Megs since the way Lucee jar is built keeps pack200 from being able to work.
I need some way I can unpack the Lucee jar in our CommandBox build process so that all the jars can be compressed correctly via pack200 to get my smaller binary file sizes back. Can you help?
One of Micha’s replies was:
what you also can do is removing all jars from the lucee.jar and make sure they are added to the bundles folder when starting up.
My unanswered followup questions were as follows:
This is a good idea. What about the extensions? They are basically just archives in jar files. is there a way to compress those?
Also, what about the big lco file? Isn’t that basically just a jar?
Would it work to extract it, rename it to a jar, pack200 it, and then on first run, rename it back to an lco file? Does it have to be inside the lucee.jar or is there a way to have it already in the server context?
in another thread, Micha mentioned this:
as a side note, Lucee itself supports pack2000 internally for jars, so maybe in the future we can make a lucee pack2000 jar, that of course has bundled only pack2000 bundles. the bundles bundled in the lucee jar (at /bundles) can be pack200. extension need to be .pack.gz
this is an experimental feature i did never had the time to test