Optimise keyword arguments in the JIT
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 35.9k
- PR 合併指標
- PR 指標待擷取
描述
Since the JIT traces can see both sides of the call, it can remove the work done to parse and shuffle the arguments during optimization.
For example, calling the function
def foo(a, b): pass
with keyword arguments:
foo(0, b=2, a=1)
requires the tuple ("b", "a") to pushed to the stack after the arguments
and for the CALL_KW_PY instruction to parse and reorder the arguments.
We can work out the reordering required and emit the necessary stack permuting code,
then replace the CALL_KW_PY with a much more effcient CALL_PY_EXACT_ARGS
In the example above:
LOAD_CONSTANT ("b", "a")
CALL_KW_PY 3
can be replaced with
SWAP 2
CALL_PY_EXACT_ARGS 3
Linked PRs
- gh-151389
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 JIT 對 CALL_KW_PY 和 CALL_PY_EXACT_ARGS 的處理開始,使用 issue 中的關鍵字呼叫範例來理解所需的參數重新排列。完成的標準是 JIT 能夠以執行堆疊置換的程式碼和精確參數呼叫取代關鍵字呼叫,同時保留所示的呼叫行為;gh-151389 與此工作相關聯。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- compilers, performance
- Issue 類型
- 重構
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100