Python is faster than C

Joe Mason joe at notcharles.ca
Sat Apr 3 17:33:22 EST 2004


In article <406F0907.96F37EA1 at tunes.org>, Armin Rigo wrote:
> The reason that Psyco manages to outperform the C implementation is not
> that gcc is a bad compiler (it is about 10 times better than Psyco's).
> The reason is that the C implementation must use a generic '<' operator
> to compare elements, while the Psyco version quickly figures out that it
> can expect to find ints in the list; it still has to check this
> assumption, but this is cheap and then the comparison is done with a
> single machine instruction.

Why can't the C implementation do the same thing?

Joe



More information about the Python-list mailing list