[BangPypers] Tuples vs Lists, perfromance difference

Dhananjay Nene dhananjay.nene at gmail.com
Thu Dec 24 11:59:16 CET 2009


On Thu, Dec 24, 2009 at 2:36 PM, Senthil Kumaran <orsenthil at gmail.com>wrote:

> On Thu, Dec 24, 2009 at 11:19:18AM +0530, Navin Kabra wrote:
> >
> > Nope. With JIT compilation, a JVM can actually beat C++
>
> This seems a controversial statement to make. I have seen this come up
> time and again at various blog posts all trying convince one thing
> over the other.
>

Why would it be controversial if it is actually observed behaviour ? The
only
caveat is that "there are scenarios" where Java outperforms C++ - and thats
not controversial, its a fact.  It is helpful to understand that Java
outperforms
C++ "some times". Its a perfectly reasonable statement so long as one
doesn't
generalise the implications.

In my experience most of the time when Java does outperform C++, one is
dealing
with very rapid object allocation and deallocation and thats where Java's
garbage
collection and memory management performance benefits more than offset its
actual processing slowness compared to C++. But refining the memory
management
in C++ code again makes it work much faster than java (though with a higher
development cost)


>
> > Overall, though, from the shootout page, it looks like Java is comparable
> to
> > C/C++ in many cases, and a little slower in some cases. Python, on the
> other
> > hand, is 10x to 30x slower in most cases... So my point still stands
>
> It did it show that Java is 2x slower than C++ most of times while
> Python 10x slower or more. This was a observation across the tests
> with some exceptions.
>
> When I said about Python vs Java, I was specifically thinking about an
> Web server designed in a asynchronous, multi-threaded (read Twisted)
> way, some earlier research made me think that Java performance, with
> the frills required, would be comparable, but strictly speaking, I do
> not know, as I did not write the program in Java and Python do the
> comparison. Programmer's area of expertise helped here more with the
> choice. :)
>

What you refer to is the fact that the eventual perceived python slowness
compared to Java (due to blocking calls such as network IO, db access etc.)
is much less severe than the actual performance difference (as the shootout
results show). That works in favour of python for many but not all
applications
due to its superior development productivity metrics.

Dhananjay

>
>
> --
> Senthil
> Old MacDonald had an agricultural real estate tax abatement.
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>



-- 
--------------------------------------------------------
blog: http://blog.dhananjaynene.com
twitter: http://twitter.com/dnene
           http://twitter.com/_pythonic


More information about the BangPypers mailing list