Use interned versions of string constants if they're already present
未關閉
還沒有人認領這個 Issue。
easy
interpreter-core
performance
type-feature
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
Feature or enhancement
Proposal:
For now intern_constants function in Objects/codeobject.c uses should_intern_string to check if that string should be interned. And do nothing if should_intern_string returned 0. Maybe it'll be better to check if this string already have interned variant and use it if present? Because there's no need to keep equal strings in memory. The small downside is some time needed for this checking.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
- gh-140688
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 Objects/codeobject.c 中的 intern_constants 開始,追蹤 should_intern_string 目前如何判斷字串是否會被 intern。在開始之前查看連結的 PR gh-140688,並在能夠重用現有的 intern 等價字串且不再保留重複的相同字串時,視為工作完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- c, python
- 領域
- backend, performance
- Issue 類型
- 功能
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100