V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  hanzhichao2000  ›  全部回复第 1 页 / 共 1 页
回复总数  4
2017-10-13 09:38:43 +08:00
回复了 rogwan 创建的主题 Python 相比 Python 代码, Cython 实际提升的性能有多大?
如果涉及数值计算的话,numba 可能用起来更方便,cython 毕竟还要显性配置些东西
2017-10-13 09:20:20 +08:00
回复了 rogwan 创建的主题 Python 相比 Python 代码, Cython 实际提升的性能有多大?
Ref: http://notes-on-cython.readthedocs.io/en/latest/std_dev.html

Example:

def pyStdDev(a):
mean = sum(a) / len(a)
return math.sqrt((sum(((x - mean)**2 for x in a)) / len(a)))


In summary:

================= ============ ================== =====================
Method Time (ms) Compared to Python Compared to Numpy
================= ============ ================== =====================
Pure Python 183 x1 x0.03
Numpy 5.97 x31 x1
Naive Cython 7.76 x24 x0.8
Optimised Cython 2.18 x84 x2.7
Cython calling C 2.22 x82 x2.7
================= ============ ================== =====================
- bitbucket 可以免费放私有代码
- yandex disk 试试看?
2016-09-07 18:37:20 +08:00
回复了 zmrenwu 创建的主题 Python 1 亿条数据如何使用 Pandas 去重?
blaze 或 dask ,语法类似 pandas ,比数据库和 Hadoop 都轻
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   980 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 18ms · UTC 20:48 · PVG 04:48 · LAX 13:48 · JFK 16:48
Developed with CodeLauncher
♥ Do have faith in what you're doing.