Python 3.14 采用新型解释器,速度提高-3%~30%

1 天前
 codists

Python 官方文档( https://docs.python.org/3.14/whatsnew/3.14.html#a-new-type-of-interpreter) :

A new type of interpreter based on tail calls has been added to CPython. For certain newer compilers, this interpreter provides significantly better performance. Preliminary numbers on our machines suggest anywhere from -3% to 30% faster Python code, and a geometric mean of 9-15% faster on pyperformance depending on platform and architecture. The baseline is Python 3.14 built with Clang 19 without this new interpreter.

其实我很想知道,这种性能测试的结果到底准不准?熟悉这方面的大佬来聊聊。

4333 次点击
所在节点    Python
27 条回复
vkillwucy
1 天前
盲猜一个不准
crackidz
1 天前
https://github.com/faster-cpython/benchmarking-public 可以看下他们跑的基准测试都跑了哪些场景
xgdgsc
1 天前
准肯定是准的,就是真需要这个性能的早都转 Julia rust cpp 了
alwaysol
16 小时 10 分钟前
提高-3%?
strobber16
15 小时 28 分钟前
go 1.24 使用新型 runtime ,速度提高 2%~3%
coolcoffee
14 小时 53 分钟前
我怎么感觉是 python 之前的性能实在是太差,所以显得进步空间贼大。

就以 100 为单位,提升 5%-30%也就是 105 ~ 130 。但是 C++可能在 1000 。
GeekGao
14 小时 44 分钟前
@coolcoffee 没法相比其他语言,只能对比自己。
yh7gdiaYW
14 小时 41 分钟前
3.11 的时候也说有提升,给出的性能测试结果也不错,结果落到我们的业务场景(主要是大量数据的遍历和计算,有一些环节没法拆到 C++)中速度还变慢了...
JokerSH
14 小时 35 分钟前
@alwaysol 原文中是换行的连词符号
uni
14 小时 28 分钟前
我挺喜欢 python 的,但是 py 连 nodejs 的性能都比不过。。。
ninjashixuan
14 小时 12 分钟前
fastpython 项目多少年了,这提升龟速翻五倍的目标是不是遥遥无期了。
ninjashixuan
14 小时 7 分钟前
@uni 什么叫连,人 v8 引擎一直是高性能的标杆吧。
tsanie
13 小时 52 分钟前
@JokerSH #9
原文就是 from -3% to 30% faster 。
连词符号是在 interpreter 这个单词,而且是 css hyphens ,复制文本出来是没有连词符的。
crackidz
13 小时 47 分钟前
@yh7gdiaYW 这是常见的无感提速问题了,某些场景下就是会慢... 算是一种 trade off
Jinnrry
13 小时 26 分钟前
都用 python 了,还在乎性能吗?真需要性能,拿 c 、rust 写底层,python 调用不就行了?胶水语言就应该干胶水语言干的活
adoal
13 小时 21 分钟前
@alwaysol 意思就是有的代码运行可能会变慢一点。
Shatyuka
13 小时 15 分钟前
太厉害了 python ,很难说是不是之前太慢显得提升很多。

附 3.11 的更新日志: https://docs.python.org/3.11/whatsnew/3.11.html#faster-cpython
CPython 3.11 is an average of 25% faster than CPython 3.10 as measured with the pyperformance benchmark suite, when compiled with GCC on Ubuntu Linux. Depending on your workload, the overall speedup could be 10-60%.
lesismal
13 小时 12 分钟前
300%也还是慢...
jjx
13 小时 5 分钟前
因为从 2 到 3 , 就慢了

现在只是恢复到 2 的水准,哈哈
JokerSH
11 小时 35 分钟前
@tsanie 你说的对,是我想当然了,很抱歉。感谢指正。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://tanronggui.xyz/t/1111032

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX