-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Library size increased 230% from v3 to v4 #183
Comments
All of the dependencies are either kotlin, or getting changed to kotlin |
I wouldn't recommend trying to strip the kotlin runtime. If you don't use any of the workarounds, you can probably remove javassist. |
So, is there a plan to shrink the size back down to 3.x measurements? It's not the worst thing in the world, I've just always tried to reign in unecessary bloat since this is an embedded tool. |
The only thing I can think of is using ProGuard to strip out unused classes, which will make the jar super tiny. Don't do this for the SystemTray, but for it's dependencies. There's also something called SlimJar, and you can even setup downloading the dependencies on download (java can run jars from an URL, in addition to from a file) |
Once the system tray is using Kotlin, there is a LOT of code that can safely be culled. Exactly how much? I cannot say, but my other projects saw a reduction by 40% or so |
This conversation is continued in issue #184. |
The irony here is that the Kotlin runtimes seem on their own to be nearly as large as the entire SystemTray library before it used Kotlin. So here's hoping that Kotlin replaces 99% of it :) |
You're right, the topics are divergent. Have you thought about running pack200 on the jars? edit: jar's don't compress that well with standard zip/lz/etc algos. Pack200 is the algo to compress them. The JVM should auto-decompress them when loading them. |
Yes, I used Pack200 for years and had good results, but I was forced to remove it when Java 14 came out and Pack200 was removed. Oracle made that decision for me :/ It's frustrating because they largely cite I know in the world of fast internet, a few megs isn't a lot to download, but I've long since been stymied by how difficult it is to get a Java tool anywhere in the vicinity of things like the Go runtime. Pretty much all Go CLI tools are like 8 MB AND bundle the entire runtime. Heck, an entire GoLang docker image/website can be like 10 Megs. My CLI tool is an 80 MB binary WITHOUT a JRE (now that Pack200 is no longer viable) which extracts to over 300 MB on disk thanks to the glorious excess of OSGI and dozens of modules my user "might need". It's a battle to keep a dockized CFML app under 600 Megs if using Adobe ColdFusion with many of them ringing in our a Gig if no care is taken to shrink them. (My CLI tool that bundles SystemTray is the base for a number of CF Docker images) |
oh wow. |
just had an idea. Strip out the classfile |
I’m going to close this issue - however the last thought that comes to mind, is that you can safely exclude the JNA specific bindings for os/arch combinations that you know you will not be used (for example, as this in going to run in docker, it’s likely only linux 32/64/arm/aarch64 will be used, it’s unlikely that solaris will be used). This will shave down quite a bit of space. |
My tool is bundled up as a stand-alone executable that's made to be run on any OS with any CPU architecture as a general purpose development tool and server, so unfortunately there's really nothing I'd be able to safely eliminate. |
The system tray 3.17 dependency was only 3.8 megs in size, but 4.2 has jumped to 9 Megs. This is a pretty big jump and adds a noticeable amount to my tool that bundles System tray. Is there a way to trim down what is bundled? For example, I'd like to not need to pack in the Kotlin runtime just for the system tray library to work.
The text was updated successfully, but these errors were encountered: