Interesting speed benchmark
Michael Lunnay
mlunnay at bigpond.net.au
Wed Jun 6 00:12:27 EDT 2001
Having just finished working on 2 assignments in java, solidly for the last
month, I can see a major flaw in that benchmark. That is the javac time,
that seems to take a hell of a long time, and as python compiles to byte
code (assuming the code was a first run) you would need to add that, and
even for a 10 line file (the smallest I had to compile) javac takes an
eternity...
Michael
"Mahesh Padmanabhan" <micronospampad at nospam.yahoo.com> wrote in message
news:3B1D6FED.4070506 at nospam.yahoo.com...
> Hello,
>
> To email me remove "nospam" from the email address.
>
> I came across this web site:
> http://www.twistedmatrix.com/~glyph/rant/python-vs-java.html
>
> in which the author does some (by his own admission) subjective
> benchmarks between java and python. While most of it is usual stuff, the
> one test that stood out was the following:
>
> (I am using a Debian woody system with Python 2.1 and JDK 1.3 from
> blackdown on an Intel system)
>
> Python program:
> ---------------
>
> class ObjectTest:
> pass
>
> for i in xrange(1000):
> root=ObjectTest()
> for j in xrange(10000):
> root.next=ObjectTest()
> root=root.next
>
> Time:
>
> real 1m23.326s
> user 1m23.290s
> sys 0m0.060s
>
>
> Java program:
> -------------
>
> public class ObjectTest {
> public ObjectTest next;
> public static void main(String[] args) {
> for (int i = 0; i < 1000; i++) {
> ObjectTest root = new ObjectTest();
> for (int j = 0; j < 10000; j++) {
> root.next=new ObjectTest();
> root=root.next;
> }
> }
> }
> }
>
> Time:
>
> real 0m2.428s
> user 0m2.190s
> sys 0m0.220s
>
> There is a huge difference in performance. In fact I tried this under
> Windows NT 4 SP5 with Python 2.1 and jdk1.3 from SUN and got similar
> results.
>
> I am very curious to know why Python takes so much time.
>
> Thanks
>
> Mahesh
>
More information about the Python-list
mailing list