从 3.7 到 3.11
• Manjusaka,一个 Python 爱好者
• 一个 SRE
• Python MVP,捕蛇者说播客联合创始人
• 摇曳露营粉丝(这也是我现在网名 Nadeshiko Manju 的由来)
• 我的邮箱 me@manjusaka.me
• 性能
• 类型体验
• 开发者体验
性能 类型系统 开发者体验
性能进化
• 实际上从 Python 3.6 时期就开始了
• 在 Guido 入职微软后,开启了 Fast Python 计划
(微软大法好?(逃
• 整体的加速方向分为三个方向
• 1. 内存效率的优化
• 2. 解释器执行效率优化
• 3. 去除 GIL 的影响
• Dict 布局优化(Python3.6,BPO-27350)
• Pickle 升级(Python 3.8)
• 解释器升级,LL->PEG (Python 3.9)
• Python Dict 在 Unicode 下的优化(Python 3.11 BPO-46845)
内存效率优化
• operator.itemgetter() 速度提升 30%(标准库极大收益,BPO-
35664,Python3.8)
• subprocess 性能优化(BPO-35537,Python 3.9)
• 除法性能优化(BPO-39434, Python 3.9)
• PyType_Lookup 性能优化(BPO-43452,Python 3.10)
• PyFrame 布局优化(BPO-44590,Python 3.11 Faster
Python)
• 内敛 Python 函数调用(BPO-45226,Python 3.11 Faster
Python)
• 指令特化(PEP 659,Python 3.11)
解释器执行效率优化
• PEP 684,Per Interpreter GIL(Merged,Issue-
99113)
去除 GIL 的影响
性能 类型系统 开发者体验
• PEP 563,Postponed Evaluation of Annotations, Python
3.7
• PEP 585 ,Type Hinting Generics In Standard Collections,
Python 3.9
• PEP 647 , User-Defined Type Guards,Python 3.10
• PEP 613 , Explicit Type Aliases,Python 3.10
• PEP 604 ,Allow writing union types as X | Y ,Python 3.10
• PEP 673 , Self Type,Python 3.11
类型系统进化
性能 类型系统 开发者体验
• 包管理百花齐放
• PEP 582 奠定大方向
• 社区包管理百花齐放
• PDM
• Petry
• Rye
• Pip
• etc..
开发者体验
• 从 3.4 到 3.11 Python 无论在性能还是严谨性上都
得到了极大的提升
• Python 后续的若干版本还会有很大的变化,比如
GIL 逐渐移除,引入 JIT 等
• Make Python Great Again!
Python 进化之路.pptx

Python 进化之路.pptx

  • 1.
  • 2.
    • Manjusaka,一个 Python爱好者 • 一个 SRE • Python MVP,捕蛇者说播客联合创始人 • 摇曳露营粉丝(这也是我现在网名 Nadeshiko Manju 的由来) • 我的邮箱 me@manjusaka.me
  • 4.
  • 5.
  • 6.
    性能进化 • 实际上从 Python3.6 时期就开始了 • 在 Guido 入职微软后,开启了 Fast Python 计划 (微软大法好?(逃 • 整体的加速方向分为三个方向 • 1. 内存效率的优化 • 2. 解释器执行效率优化 • 3. 去除 GIL 的影响
  • 7.
    • Dict 布局优化(Python3.6,BPO-27350) •Pickle 升级(Python 3.8) • 解释器升级,LL->PEG (Python 3.9) • Python Dict 在 Unicode 下的优化(Python 3.11 BPO-46845) 内存效率优化
  • 8.
    • operator.itemgetter() 速度提升30%(标准库极大收益,BPO- 35664,Python3.8) • subprocess 性能优化(BPO-35537,Python 3.9) • 除法性能优化(BPO-39434, Python 3.9) • PyType_Lookup 性能优化(BPO-43452,Python 3.10) • PyFrame 布局优化(BPO-44590,Python 3.11 Faster Python) • 内敛 Python 函数调用(BPO-45226,Python 3.11 Faster Python) • 指令特化(PEP 659,Python 3.11) 解释器执行效率优化
  • 9.
    • PEP 684,PerInterpreter GIL(Merged,Issue- 99113) 去除 GIL 的影响
  • 10.
  • 11.
    • PEP 563,PostponedEvaluation of Annotations, Python 3.7 • PEP 585 ,Type Hinting Generics In Standard Collections, Python 3.9 • PEP 647 , User-Defined Type Guards,Python 3.10 • PEP 613 , Explicit Type Aliases,Python 3.10 • PEP 604 ,Allow writing union types as X | Y ,Python 3.10 • PEP 673 , Self Type,Python 3.11 类型系统进化
  • 12.
  • 13.
    • 包管理百花齐放 • PEP582 奠定大方向 • 社区包管理百花齐放 • PDM • Petry • Rye • Pip • etc.. 开发者体验
  • 14.
    • 从 3.4到 3.11 Python 无论在性能还是严谨性上都 得到了极大的提升 • Python 后续的若干版本还会有很大的变化,比如 GIL 逐渐移除,引入 JIT 等 • Make Python Great Again!