On Sep 29, 2009, at 4:36 PM, Greg Ewing wrote: > Chris Colbert wrote: > >> over 6x improvement just by avoid a few measly pow statements... >> anyone know why i'm stuck in slowpow? > > Using pow to calculate x**2 is always going to be slower > than x*x, no matter how smart the pow function is. Function > calls have some overhead, even in C.
The pow function is a builtin, so it can be really "smart." Interestingly, I just tested and pow(x, n) is optimized away for n=-1, 0, 1, and 2. (gcc 4.0.1) giving the obvious code for those four cases. - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
