From: Panayotis K. <pan...@pa...> - 2010-08-31 15:55:11
|
After the talk about Scala under iPhone, and since the Scala library is too big (~8MB), I thought to have a look at java shrinkers. Since most people were talking about ProGuard & Android projects, I give it a shot. If this is successful enough, this will be a gain not only for Scala or whatever, but also for OpenJDK and similar approaches that depend on other JAR files :) I have to say that I was quite successful with ProGuard. It works even for strangely crafted classes, like the Scala's ones. The only problem with ProGuard is that it performs a quick class-based optimization only. For a simple hello-world application (with some Scala-based features), it required ~350kb of classes from the Scala framework (from a total of ~6MB library). Not bad, but not good enough. I also had a look at yGuard, which is a free (but not completely open source) project, which performs method- and variable- based optimizations. Unfortunately I wasn't lucky, at least with Scala projects, it crashed with a message: "yShrink encountered an unknown problem!" In ProGuard site there is a list of other shrinkers. Of course we heading only for open source, or at least free implementations. Here is the list: http://proguard.sourceforge.net/alternatives.html Since ProGuard does a good job with class-based shrinking, we are actually looking for method-based shrinking. Even if this is too slow, we could have ProGuard make a pre-selection of classes and then let the second library do the mathod-based selection. What do you think? I believe that this task is really necessary and will help a lot with every project, especially with the new upcoming C backend, but it needs testers ;) |