问题描述
这是我正在使用的代码,
from uuid import uuid1,uuid4
def test1(n):
for _ in range(0,n):
uuid1()
def test4(n):
for _ in range(0,n):
uuid4()
运行结果
In [65]: %timeit test1(1000000)
22.1 s ± 1.01 s per loop (mean ± std. dev. of 7 runs,1 loop each)
In [66]: %timeit test4(1000000)
5.55 s ± 600 ms per loop (mean ± std. dev. of 7 runs,1 loop each)
如您所见,uuid4的生成似乎比uuid1快5倍。我知道了解uuid方案https://en.wikipedia.org/wiki/Universally_unique_identifier
uuid1在哪里度过时间?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)