Java vs Python performance

Always good to provide some non-scientific comparative performance data – tends to rub people the wrong way, but here goes anyway πŸ™‚

Anyway, http://www.twistedmatrix.com/~glyph/rant/python-vs-java.html detailed a quick performance evaluation that I thought was ‘sort of ‘ useful for some research I was doing – then I saw the date on the page – 2000 – which is shall we say, a ‘tad’ old. So I thought i’d re-run the tests on a current platform, in this case Ubuntu 7.10 ‘Gutsy’. As i’m only interested in the performance ratio between Java and Python rather than the overall performance increase due to improvements in underlying hardware i’ve converted the results on the previous web page to a ratio (Java/Python) as well to see how the systems have changed in the last 7 years.

Test Ratio (Java/Python) in 2000
Standard Output 4.54
Hashtable 2.06
I/O 1.19
List 0.31
Interpreter Init 6.25
Object Allocation 0.11
Interpreter Speed 0.18

As you can see from those numbers (>1) that Java was considerably slower than Python in the arbitrary tests performed. As I was a little curious to see it for myself I re-ran the code detailed on the page on my fresh gutsy system albeit with an openjdk code drop just to see if things had changed and how.

Test Ratio (Java/Python) in 2007
Standard Output 2.20
Hashtable 0.64
I/O 0.38
List 0.42
Interpreter Init 12
Object Allocation 0.034
Interpreter Speed 0.86

As you can see Java has improved in most of the tests so that it now significantly outperforms python. I guess the major disappointment is the Interpreter initialization which seems to have gotten significantly worse 😦 but overall Java performance has according to these tests improved relative to python.

Please note that I haven’t looked at the suitability of the tests themselves, merely re-run them for myself to try and improve my understanding – i’ve released it here so that there is at least a recent counterpoint to the 2000 article. Flames >/dev/null please

Advertisements

2 thoughts on “Java vs Python performance

  1. Pingback: The empire strikes back…. or does it? « MrPointy’s Weblog

  2. Pingback: Cognitive Cow - » In Defense of the Java Giant

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s