from timeit import timeit
Test involving closures
s = Stack()
timeit('s.push(1);s.pop()', 'from main import s')
0.9874754269840196Test involving a class
s = Stack2()
timeit('s.push(1);s.pop()', 'from main import s')
1.0707052160287276
from timeit import timeit
Test involving closures
s = Stack()
timeit('s.push(1);s.pop()', 'from main import s')
0.9874754269840196Test involving a class
s = Stack2()
timeit('s.push(1);s.pop()', 'from main import s')
1.0707052160287276
本文标题:python 计算函数执行时间 timeit
本文链接:https://www.haomeiwen.com/subject/djgfpctx.html
网友评论