From: Delaney, T. <tde...@av...> - 2002-01-21 22:55:44
|
> From: Justin Worrall [mailto:Jus...@mo...] > > Does anyone out there have any metrics for jython/jythonc performance > versus standard java ? I am interested in using jython for its > elegance/simplicity etc but not at the expense of a dramatic > decrease in > performance versus standard java. Stuff written in jython / > run through > the interpreter seemed very slow (jdk1.3/windows NT). I'm not > sure about > compiling to java through jythonc but notices that the java > source code > generated was very large in comparison to what I could code up in java > by hand. Any thoughts anyone ? It depends entirely on your application, but usually there is about a 10% performance penalty for using jython. As always with python, tight loops tend to suffer. There is no real performance gained by compiling using jythonc - that's primarily for packaging up a final application (say, as a .jar file). You may have a slightly-faster startup. The produced java source code (from jythonc) is of course much longer and more complex than what you could write directly in java - it has to deal with all the dynamism of python. You will find the same type of thing any time you have one language translated to another (for example, CFront, which was one of the earliest methods of coding in C++ - it translated everything to very horrible-looking C). OTOH, the python code is almost certainly much more compact and readable. I you find there is a real performance problem, there is usually no trouble coding the problem areas in java. One good method to do this is to create a base class in java, with the performance-critical sections implemented in the base class, then create a python class extending that base class to do most of the work in python. Tim Delaney |