python 计算函数执行时间 timeit
2019-12-03 本文已影响0人
SkTj
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