Optimize logging package import overhead with lazy imports
未关闭
还没有人认领这个 Issue。
performance
stdlib
type-feature
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
import logging.config costs ~29 ms and import logging.handlers ~26 ms, but most of what they
import is only needed conditionally based on feature usage (socket/HTTP/SMTP
handlers, the config socket listener, multiprocessing queue detection).
Apply lazy imports to the modules within the logging package while preserving finalization and shutdown expectations.
(PR is already prepared)
Linked PRs
- gh-156778
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 logging.config 和 logging.handlers 模块开始,测量它们当前的导入开销,并跟踪仅由 socket、HTTP、SMTP、configuration-listener 和 multiprocessing-queue 功能使用的导入。确认延迟加载能够保留终结和关闭行为,然后比较更改前后的导入时间和条件功能行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- observability
- Issue 类型
- 重构
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100