Title: Make a precompiled standalone jar available
Type: rfe Severity: normal
Components: None Versions: Jython 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: alex.gronholm, fwierzbicki, jmalinen, pekka.klarck, zyasoft
Priority: low Keywords:

Created on 2009-07-16.22:04:49 by alex.gronholm, last changed 2015-03-29.05:37:12 by zyasoft.

msg4913 (view) Author: Alex Grönholm (alex.gronholm) Date: 2009-07-16.22:04:49
Currently, the standalone jar file contains .py files, which will have
to be compiled to .class files during runtime. I request that this be
either replaced with, or supplemented with an another standalone jar
that only contains the compiled .class files instead of the source .py
files to avoid the compilation overhead.
msg6108 (view) Author: Jussi Malinen (jmalinen) Date: 2010-09-29.14:11:22
We have run into this same issue. Our program starts in 15 seconds with the normal standalone jar and with class files included this drops to 9 seconds.

Our system (Robot Framework) is restarted repeatedly in some environments, so this is a serious speed issue for us.

Here example times with just some simple imports (as noted, our program shows even bigger time differences):

time java -jar compiled.jar  -c 'import unicodedata, os, time, unittest, datetime, subprocess, zipfile, httplib'

real	0m6.710s
user	0m10.816s
sys	0m0.462s

time java -jar not_compiled.jar  -c 'import unicodedata, os, time, unittest, datetime, subprocess, zipfile, httplib'

real	0m8.858s
user	0m13.664s
sys	0m0.412s
msg6109 (view) Author: Jussi Malinen (jmalinen) Date: 2010-09-29.14:25:00
Also, for some reason we didn't get this new jar with compiled classes to work without also including the original py-files. We had to include both class and py-files in the jar.

We couldn't figure out why this was.
msg6111 (view) Author: Alex Grönholm (alex.gronholm) Date: 2010-09-30.12:35:46
I have a Jython application deployed with only .class files in the jars. Works fine. Just make sure you don't mix and match Java and especially Jython versions there. Class files compiled on a different Jython version don't work with another version -- the class loader simply ignores them.
msg6112 (view) Author: Jussi Malinen (jmalinen) Date: 2010-09-30.12:52:19
Interesting. We are compiling the class files with the very same jython jar so that should not be the issue. Also java version stays the same.

Our own program does work without the py-files included. It is only the Jython standard libraries that seem to need the py-files in jar. Jython does find the class files though, because we do see that considerable speed up.
msg7729 (view) Author: Alex Grönholm (alex.gronholm) Date: 2013-02-20.22:16:03
One drawback seems to be that such jars would be tied to a specific JRE vendor and major version. Any other restrictions that come to mind?
msg7830 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2013-02-27.02:09:45
What we might be able to do is have an option in the installer to include or not include pre-compiled $py.class files. I don't think we want to explode the number of release packages more.
msg7831 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2013-02-27.02:11:13
And if we did go with the installer route, we could also have an option to have only the $py.class files, leaving out the .py files for space.
msg7832 (view) Author: Alex Grönholm (alex.gronholm) Date: 2013-02-27.02:13:55
I was hoping that one day this could be made into a JNLP extension, hosted somewhere (by the PSF?). For me, that was the main point.
msg7834 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2013-02-27.16:25:28
Ah - maybe we should open up a new tracker item with that as the subject? I don't know exactly what is involved in making a JNLP extension, but I vaguely recall it isn't that difficult. We could make a JNLP target in our build.xml and then find out where the PSF likes to host things (I suspect it's the same place that the Jython website lives)
msg9629 (view) Author: Jim Baker (zyasoft) Date: 2015-03-11.23:41:21
Urgent bug #2282 is essentially a duplicate
msg9695 (view) Author: Jim Baker (zyasoft) Date: 2015-03-21.05:35:05
Now fixed in #2282, with a modest performance speedup:

# no $py.class files in Lib/ in the jar
time java -jar jython-standalone.jar  -c 'import unicodedata, os, time, unittest, datetime, subprocess, zipfile, httplib'

real	0m8.666s
user	0m16.299s
sys	0m0.448s

# with $py.class files in the Lib/
$ time java -jar jython-standalone.jar  -c 'import unicodedata, os, time, unittest, datetime, subprocess, zipfile, httplib'

real	0m6.134s
user	0m12.422s
sys	0m0.397s

So some improvement not having to compile these modules.

Currently Lib/test/** files are being excluded.
Date User Action Args
2015-03-29 05:37:12zyasoftsetstatus: pending -> closed
2015-03-21 05:35:05zyasoftsetstatus: open -> pending
assignee: zyasoft
resolution: fixed
messages: + msg9695
versions: + Jython 2.7, - Jython 2.5
2015-03-11 23:41:21zyasoftsetnosy: + zyasoft
messages: + msg9629
2013-02-27 16:25:28fwierzbickisetmessages: + msg7834
2013-02-27 02:13:55alex.gronholmsetmessages: + msg7832
2013-02-27 02:11:13fwierzbickisetmessages: + msg7831
2013-02-27 02:09:59fwierzbickisetpriority: low
2013-02-27 02:09:45fwierzbickisetmessages: + msg7830
2013-02-20 22:16:03alex.gronholmsetmessages: + msg7729
2013-02-20 19:17:43fwierzbickisetversions: + Jython 2.5, - 2.5.1
2010-09-30 12:52:19jmalinensetmessages: + msg6112
2010-09-30 12:35:46alex.gronholmsetmessages: + msg6111
2010-09-29 14:25:00jmalinensetmessages: + msg6109
2010-09-29 14:11:23jmalinensetnosy: + pekka.klarck, jmalinen
messages: + msg6108
versions: + 2.5.1
2009-08-16 16:11:08fwierzbickisetnosy: + fwierzbicki
2009-07-16 22:04:49alex.gronholmcreate