# coding=utf-8
# 【https://www.getdrip.com/deliveries/0f8zremspi6podm37t7o?__s=yem3zfyaqmpq35qng74b】
import timeit
it = timeit.timeit('"-".join(str(n) for n in range(1000))', number = 10000)
print(it) # 4.06215424
it = timeit.timeit('"-".join([str(n) for n in range(1000)])', number = 10000)
print(it) # 3.3500846929999994
it = timeit.timeit('"-".join(map(str, range(1000)))', number = 10000)
print(it) # 2.6244223999999994
测试性能
最新推荐文章于 2023-09-15 10:19:01 发布