Why is Python slow? (was Re: One Python 2.1 idea)

Andreas Jung andreas at andreas-jung.com
Mon Dec 25 05:06:48 EST 2000


On Mon, Dec 25, 2000 at 01:06:48AM +0000, Neelakantan Krishnaswami wrote:
> The Python code was:
> 
> def loop(n):
>     t = time.time()
>     while n != 0:
>         n = n - 1
>     return time.time() - t
> 
> def loop2(n):
>     t = time.time()
>     for i in xrange(n):
>         pass
>     return time.time() - t

This code is not very useful for real-world benchmarks. We have build several
large systems with Python and I have seen FEW situations where Python is REALLY
slow. As a universal scripting language Python is fast enough for most purposes. So
it is not really a good idea to measure the speed of Python with such a useless
benchmark.

Andreas





More information about the Python-list mailing list