今天想知道for循环的速度,所以做一下测试

1. for循环一万次  耗时2毫秒

    python for 循环的速度

 

 

2. for循环十万次  耗时22毫秒

    python for 循环的速度

 

3. for循环一百万次  耗时304毫秒

    python for 循环的速度

 

 

4. for循环一千万次  耗时2337毫秒,也就是2.3秒

    python for 循环的速度

 

 

5. for循环一亿次  耗时23468毫秒,也就是23.4秒

    python for 循环的速度

 

 

为什么要做这个测试,就是想通过测试,看看python的 for 循环的速度。

 

相关文章:

  • 2022-01-06
  • 2021-09-28
  • 2022-01-09
  • 2022-01-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2021-08-30
  • 2022-12-23
  • 2021-12-05
  • 2021-09-21
相关资源
相似解决方案