[Python-Dev] Python is faster than C

Gareth McCaughan gmccaughan at synaptics-uk.com
Mon Apr 5 07:07:45 EDT 2004


On Saturday 2004-04-03 20:59, Armin Rigo wrote:
> Hi!
> 
> This is a rant against the optimization trend of the Python interpreter.
> 
> Sorting a list of 100000 integers in random order takes:
> 
> * 0.75 seconds in Python 2.1
> * 0.51 seconds in Python 2.2
> * 0.46 seconds in Python 2.3
> 
> Tim Peters did a great job optimizing list.sort().  If I try with a
> simple, non-stable pure Python quicksort implementation, in Python 2.3:
> 
> * 4.83 seconds
> * 0.21 seconds with Psyco
> 
> First step towards world domination of high-level languages :-)

Mhm. And what happens if you want to sort something other
than integers? Say, Python objects with their own comparison
operators? Or even just (int,int) tuples?

-- 
g




More information about the Python-Dev mailing list