Java vs Python Benchmarks: Java is faster

Bryan bryan at
Fri Feb 1 03:23:47 CET 2002

dman wrote:

> I'm still not willing to give java the benefit of the doubt yet.

Agreed. The test suites are rather limited in nature. I would welcome the 
results of a more in-depth analysis. However, the trollish nature of my 
post and resulting low number of replies leads me to believe no one can or 
is willing to really back up any claims to the contrary.
> Did you try any GUI stuff in the tests?  Did you try any largish
> programs?  In all my experiences running java apps (ie JBuilder,
> 'deploytool' from J2EE, IBM VisualAge for Java, Wilmascope (a J3D OSS
> app), etc) they tend to be slow and memory hogs.  Interestingly
> enough, too, there doesn't seem to be a way to increase the max heap
> size of javac and I've seen it bomb with java.lang.OutOfMemoryError
> trying to compile a large source tree while the system still had lots
> of RAM/swap to play with.

No GUI tests were involved. I concurr that Java is a memory hog, perhaps I 
should have also profiled memory usage for each test?

> A little while back I wrote a script in python to obfuscate package
> and class names in a java source tree.  (for in-house use at my
> current employer)  I used CPython 2.2 and a bunch of regexes for
> identifying the occurences of the class/package names in the source
> files.  It can process the whole 15MB source tree in about 30 seconds
> and using no more than 7MB RAM at peak with 2-3MB most of the time.
> I'll likely have to recode it in java (no one else there speaks
> python), but I'll bet it won't be nearly as good (both in
> terms of read/write-ability of the code and performance).

Let me know how it turns out... The tests show file IO is faster in Java, 
yet from personal experience, regex in python is superior.

> (admittedly I didn't yet follow the URL you posted, but I will check
> it out later)

Check it out if you want to run the tests yourself. I find the page rather 
biased and hope they will include my updated results.

Happy coding, 
Bryan Mongeau
"Let us understand what our own selfish genes are up to, because we may 
then at least have a chance to upset their designs, something that no other 
species has ever aspired to do." -- Richard Dawkins

More information about the Python-list mailing list