ConardLi.github.io icon indicating copy to clipboard operation
ConardLi.github.io copied to clipboard

while循环效率问题

Open lingtoo opened this issue 5 years ago • 1 comments

我对clone4的DEMO文件涉及到的WHILE循环的效率表示质疑,本地测试到的结果(node环境):

clone1 在前,clone2在后, 结果:

undefined: 0.167ms
undefined: 0.126ms

将 clone1 跟 clone2 调下位置,即clone2放在前面,结果:

undefined: 0.254ms
undefined: 0.081ms

即所消耗的时间跟调用的先后顺序有关,而不是WHILE循环的优化结果,不知你怎么看?

lingtoo avatar Sep 21 '19 11:09 lingtoo

我对clone4的DEMO文件涉及到的WHILE循环的效率表示质疑,本地测试到的结果(node环境):

clone1 在前,clone2在后, 结果:

undefined: 0.167ms
undefined: 0.126ms

将 clone1 跟 clone2 调下位置,即clone2放在前面,结果:

undefined: 0.254ms
undefined: 0.081ms

即所消耗的时间跟调用的先后顺序有关,而不是WHILE循环的优化结果,不知你怎么看?

https://blog.csdn.net/haochuan9421/article/details/81414532

Canight avatar Apr 09 '21 07:04 Canight