On Tue, Nov 11, 2008 at 14:25, Victor Stinner
<[EMAIL PROTECTED]>wrote:

> There are some very interesting propositions (with patches!) to optimize
> Python int and long types (especially the long integers).


Here's another one:
http://code.python.org/loggerhead/users/twouters/intopt-- integer
inlining through pointer tagging trickery. In Python 2.6 it costs
2-4% overall performance but increases integer arithmetic (in the range
[-0x40000000, 0x40000000) only) by 10-20% according to my rough measurements
(I haven't tried your benchmark yet.) I haven't ported it to 3.0 but it
should provide a bigger win there. It also breaks API compatibility in a few
ways: Py_TYPE(o) and Py_REFCNT(o) are no longer valid lvalues, and they and
Py_INCREF(o) and Py_DECREF(o) may all evaluate 'o' twice. And, worst of all,
it exposes the tagged pointers to third-party extensions, so anything not
doing typechecks with Py_TYPE(o) will likely cause buserrors.

In retrospect, perhaps this is too controversial to be added to the list ;-)
I don't really expect this to be something CPython would want to use as-is,
although there may be use for tagged pointers in more controlled
environments (like function locals.)

-- 
Thomas Wouters <[EMAIL PROTECTED]>

Hi! I'm a .signature virus! copy me into your .signature file to help me
spread!
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to