Java for loop vs. while loop. Performance difference?

前端 未结 16 1614
长发绾君心
长发绾君心 2020-11-28 09:35

Assume i have the following code, there are three for loop to do something. Would it run fast if i change the most outer for loop to while loop? thanks~~

<         


        
16条回答
  •  时光说笑
    2020-11-28 10:28

    Based on this: https://jsperf.com/loops-analyze (not created by me) the while loop is 22% slower than a for loop in general. At least in Javascript it is.

提交回复
热议问题