[Pyrex] Pyrex method 10x slower than Python, any hints why?
Andrew Bennetts
andrew-pyrex at puzzling.org
Fri Jun 2 03:39:32 UTC 2006
On Fri, Jun 02, 2006 at 01:03:35PM +1000, John Machin wrote:
[...]
> >
> >Perhaps the difference is that Python's eval loop special cases arithmetic
> >operations on numeric types quite heavily, but the same loop in Pyrex has to
> >resort to function calls?
> >
>
> Huh? AFAICT, all of the operations on numeric types in the quoted code
> are being done in cdef'ed variables i, sum and cost. There is *some*
> overhead caused by converting i to a Python int, and by getting the
> result of the function call (Python float) into cost.
Sorry, that was a dumb thinko! I was getting muddled with comments elsewhere
that you also tried pyrex without the cdefs.
-Andrew.
More information about the Pyrex
mailing list