[Pyrex] Pyrex optimization chitchat

Greg Ewing greg at cosc.canterbury.ac.nz
Thu Jan 22 02:09:03 CET 2004


Paul Prescod:

> And I don't know if Greg cares much about performance issues. It obviously
> was not his highest priority (which is good!).

Speeding up pure-Python code isn't a priority. But I'm not
averse to improving performance where it can be done without
much difficulty.

> There are a few different ways to handle this depending on how important you
> feel it is that len(foo) really always call __builtins__.len(foo) even if
> the type of "foo" is known.

I'm quite happy to forego the dynamicity of builtins in order to
optimise this sort of thing. I'm planning to pre-declare some of the
builtins as being equivalent to certain API calls, e.g. len()
would be equivalent to PyObject_Size().

> Also, maybe I'm just superstitious but is it possible that all of the
> "gotos" would confuse the C compiler's optimizer? I'm not claiming I've done
> any research into this.

It shouldn't be much worse that what happens in any hand-written
module that does error checking properly, should it?

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+




More information about the Pyrex mailing list