Java vs Python Benchmarks: Java is faster

Jason Orendorff jason at jorendorff.com
Fri Feb 1 00:04:02 EST 2002


> 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 [...]

java -cp $JAVA_HOME/lib/tools.jar -Xmx... sun.tools.javac.Main ...

> 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).
> 
> Any comments?

1.  You can buy a real obfuscator for a few hundred bucks.

2.  Whatever you buy will be written in Java.  (And it will
    probably work at the class-file level rather than the
    source level, which is a good thing.)

3.  If you must do this yourself:  ANTLR (for example) comes
    with everything you need to tokenize Java source code (or
    fully parse it, if you prefer).  It should be quite speedy,
    and more foolproof than slinging regular expressions.

## Jason Orendorff    http://www.jorendorff.com/




More information about the Python-list mailing list