Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
Description
Feature or enhancement
Proposal:
From the discourse discussion:
Integers are ubiquitous, both in Python code and the virtual machine.
However our representation of integers is somewhat clunky and inefficient.There is an old technique for handling ints efficiently in dynamic language VMs, calledtagged pointers.
A normal object pointer always has its low bits set to zero, as objects are 8 or 16 byte aligned in memory.
We can use those low bits as “tags” to denote the meaning of the high bits.
Historically, the low bit has been set to zero to indicate that the high bits are a pointer, and to 1 to indicate that the high bits are an integer.We already use another tagging scheme within the interpreter and in the frame stack, the tag indicating whether the reference is borrowed.
I expect to start small with this, initially just fixing#132508 then improving the performance of iteration over lists and tuples.
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
https://discuss.python.org/t/using-tagged-pointers-to-support-efficient-integer-operations/87950