[BangPypers] Tuples vs Lists, perfromance difference

Vishal vsapre80 at gmail.com
Thu Dec 24 08:22:06 CET 2009

well, yeah this is certainly a corner case. Its not the first place that i
was looking to improve performance. Our applications are IO bound, and so we
have done all that can be done there (by the way the IO is actually over a
hardware JTAG chain on a server board which is accessed by USB by the host
that runs Python programs)

What I was thinking is that as a matter of practice, while writing code, is
it good practice to use tuples, whenever we know that the sequence is not
going to change at runtime, and only accessing is going to happen.
Particularly if this sequence is getting made inside a function, then one
would like it be made in the least time possible, as and when the function
is called.

Thanks for all the replies.

Also interesting stuff about the Java comparison. The question remains, why
the JVM is so fast and why Python is not as far as JVM? I am sure there must
be a ton of info on this over the net :)

Best regards,
Vishal Sapre

On Thu, Dec 24, 2009 at 11:19 AM, Navin Kabra <navin.kabra at gmail.com> wrote:

> On Thu, Dec 24, 2009 at 7:39 AM, Senthil Kumaran <orsenthil at gmail.com
> >wrote:
> > Here is the link:
> > http://shootout.alioth.debian.org/
> >
> > There are three Java states given, Java -xint, Java steady state and Java
> > -server. Try choosing each of them and compare against Python and C++.
> > With respect to Python, you will find the alternative differences in
> > with java -xint and java -server and while java steady state will
> > always be faster ( I think, the java steady stage ignores the loading
> > of the virtual machine).
> Actually, steady state is more about ensuring that the JIT compiler has had
> time to kick in.
> I think in most cases steady state is the most useful one to compare
> against. In real life, you're typically concerned about performance in long
> running programs (i.e. seconds as opposed to milliseconds - otherwise why
> are you bothered?) and in that case, the JVM would be in steady state for
> most of the time.
> > But all of them will slower when compared to
> > C++.  Yeah, it is right to expect that JVM based will be slower than
> > compiled C++ code. Is it not?
> >
> Nope. With JIT compilation, a JVM can actually beat C++
> 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
> navin.
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers

Thanks and best regards,
Vishal Sapre


"So say...Day by day, in every way, I am getting better, better and better
"A Strong and Positive attitude creates more miracles than anything else.
Because...Life is 10% how you make it, and 90% how you take it"
"Diamond is another piece of coal that did well under pressure”
"Happiness keeps u Sweet, Trials keep u Strong,
Sorrow keeps u Human, Failure Keeps u Humble,
Success keeps u Glowing, But only God Keeps u Going.....Keep Going....."

More information about the BangPypers mailing list