why python is slower than java?
Roy Smith
roy at panix.com
Sat Nov 6 22:07:33 EST 2004
Terry Hancock <hancock at anansispaceworks.com> wrote:
> And I have certainly written some extremely poorly optimized
> Python programs that positively *crawled*.
My guess is the poor performance had nothing to do with the language you
wrote it in, and everything to do with the algorithms you used.
Local optimizations rarely gets you more than a factor of 2 improvement.
Choice of language (at least within the same general catagory such as
comparing one native compiled language to another, or one virtual
machine language to another) probably has a somewhat broader range, but
still a factor of 10 would be quite surprising.
To get really bad performance, you need to pick the wrong algorithm. A
project I worked on a while ago had a bit of quadratic behavior in it
when dealing with files in a directory. Most of our customers dealt
with file sets in the 100's. One customer had 50,000 files. Going
from, say, 500 to 50,000 is a 100-fold increase in N, and gave a
10,000-fold increase in execution time.
More information about the Python-list
mailing list