[Python-Dev] Optimization targets - refcount

Greg Ewing greg at cosc.canterbury.ac.nz
Sun Apr 18 05:23:15 EDT 2004


"Phillip J. Eby" <pje at telecommunity.com>:

> I'm not sure, however, that this would be common enough to be
> helpful.  It seems to me Py_INCREF should effectively translate to
> only a single machine instruction or two.

On a RISC architecture, probably 3 instructions -- load,
increment, store.

It's the memory accesses that will be the most expensive
part of this. But then, if increfing Py_None is really
that common, its refcount will likely be in cache.

I doubt whether it really is very common, though, compared
to increfs of all other objects.

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 Python-Dev mailing list