栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

【backtrader源码解析5】使用cython改写utils中的几个时间数字转化函数

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

【backtrader源码解析5】使用cython改写utils中的几个时间数字转化函数

优化后的结果

begin to compare python date2num and cython date2num
开始时间转化成数字
run 10000000 次,循环时间为:0.07014679908752441,cython耗费时间为:2.2787744998931885,python耗费的时间为:5.630713939666748,计算部分提升的倍数:2.470939507147668
begin to compare python time2num and cython time2num
开始时间转化成数字
run 10000000 次,循环时间为:0.06908607482910156,cython耗费时间为:1.1824824810028076,python耗费的时间为:2.6439661979675293,计算部分提升的倍数:2.2359453441756756
begin to compare python num2date and cython num2date
开始数字转化成时间
run 10000000 次,循环时间为:0.06380581855773926,cython耗费时间为:6.739114761352539,python耗费的时间为:11.535799741744995,计算部分提升的倍数:1.7117678137639791
begin to compare python num2dt and cython num2dt
开始数字转化成时间
run 10000000 次,循环时间为:0.06438589096069336,cython耗费时间为:8.041357517242432,python耗费的时间为:12.644205570220947,计算部分提升的倍数:1.5723968923293115

cython_func.pyx代码
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/739315.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号