问题
The new version of Jython 2.7.0 standalone weighs in at 36155 KB; the previous released version 2.5.3 is 14005 KB.
Is there any way to safely remove functionality from the .jar file, if certain Python packages are not needed? I want to use the updated Jython release but the file size is an issue now, much more so than 2.5.3.
回答1:
From the Jython developer mailing list:
Yes, sorry about that. We are focused on correctness first, then we will go and trim down in subsequent 2.7.x releases, where x > 0. A huge chunk of that additional bloat is supporting unicodedata and the corresponding ICU4J jar we now use.
It should be a straightforward matter of programming to remove this ICU4J dependency. Possibly this and other optimizations, especially startup time, would be suitable for a Google Summer of Code student, given that we are planning to participate this summer.
回答2:
the reason it is bigger is that in the new version the compiled class files are included in the Lib folder.
see http://bugs.jython.org/issue1403 for a discussion
In the last entry there is a post where the speedup is measured with all class files removed from the Lib and included. So I conclude that it should be possible to remove the class files from the jar and zip it up again for a smaller package.
来源:https://stackoverflow.com/questions/30337317/jython-standalone-jar-with-reduced-package-list