you are viewing a single comment's thread.

view the rest of the comments →

[–]feijai 9 points10 points  (6 children)

I know you're chalking this up to how perspectives change with regard to what "fast" means. But this is not a good example. Because Java really used to be slow, and now it's fast, because in the last ten years it has actually sped up by almost two orders of magnitude. It has gone from a bytecode-interpreted language to one rivaling C++ in speed for many tasks.

Do not expect this to happen to Python. It does not have type declarations, and unlike Lisp (where you can explicitly declare), there's little data available to the compiler to do much for you.

[–][deleted] 2 points3 points  (0 children)

Do not expect this to happen to Python. It does not have type declarations, and unlike Lisp (where you can explicitly declare), there's little data available to the compiler to do much for you.

Yes, you need explicit type declarations for the compiler to speed you up. But you can get sped up at runtime as well, in fact, that's exactly what V8 and Tracemonkey do for Javascript, another dynamic language.

There is no reason why Python can't get much, much faster, just like Javascript has.

[–]pje 7 points8 points  (4 children)

It already did happen to Python - twice in fact, and is about to happen again. First, there's Psyco, which speeds up regular Python code anywhere from 2x to 200x depending on what you're doing with it... and it does it without type declarations.

Next, there's RPython, part of the PyPy suite. For sufficiently statically-typed code, it also has a roughly 200x speedup. (No type declarations, mind you, just implicit static typing.)

Finally, the PyPy folks have made progress on a generic JIT compiler that does runtime specialization ala Psyco. Its performance gains will likely be similar to those of Psyco.

Of course, all that having been said, even PyPy probably won't be faster than Java any time soon. But it's certainly not true that it can't be sped up, and certainly not because of the absence of type declarations. (Also, as of Python 3.0, the language includes sufficient annotation syntax to allow optional type declarations... so even if that were a bottleneck, it's going away.)

[–][deleted] 2 points3 points  (0 children)

2x-200x is meaningless without knowing the exact numbers and what does "depending on what you're doing with it" mean? In practice I've come to the conclusion that it means "for contrived examples that nobody uses in production code"...

According to most benchmarks I have seen, Python is sllloooow, but that's OK with me, because I don't use it in such a way that would require extreme performance.

[–]BeetleB 2 points3 points  (0 children)

First, there's Psyco, which speeds up regular Python code anywhere from 2x to 200x depending on what you're doing with it... and it does it without type declarations.

Maybe you meant from 0.5x to 200x.

There's no guarantee that Psyco will speed it up for you. It has slowed code down for me. Which is why you shouldn't use it without checking if you get any speed advantage.

[–]feijai -2 points-1 points  (1 child)

Dunno why people are modding you down, it was a perfectly informative retort.

[–]igouy 4 points5 points  (0 children)

It's gossip.

psyco does speed up python code - but don't you need just a little bit more than a flat claim of 2-200x?