Use tagged pointers for more efficient integer operations.
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
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, called tagged 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 https://github.com/python/cpython/issues/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
Linked PRs
- gh-157353
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先閱讀 issue #132508、關聯的 pull request #157353,以及引用的 Discourse 討論,以了解提議的標記指標表示法和目前的工作。該 issue 沒有指定檔案、測試或範圍明確的實作任務;完成它需要定義並驗證更廣泛的直譯器和 VM 設計。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- compilers
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 20/100