最广为人知的限制循环迭代次数的模式称作“达夫设备”。
The most well known approach to limiting loop iterations is a pattern called Duff's Device.
改善循环性能的最好办法是减少每次迭代中的运算量,并减少循环迭代次数。
The best ways to improve loop performance are to decrease the amount of work done per iteration and decrease the number of loop iterations.
如果循环迭代次数少于1 ' 000次,你可能只看到它与普通循环相比只有微不足道的性能提升。
In cases where the loop iterations are less than 1,000, you're likely to see only an insignificant amount of performance improvement over using a regular loop construct.
So unlike Scratch where you pretty much had to say "repeat" ten times or whatever, or forever where it's just "forever" with for loops, -- can you actually specify a finite number of iterations -- and as I learned 15 years ago, finite is important.
所以不像Scratch,你大致上需要用,“repeat“10次或更多,或者需要不断地使用当它,是死循环时,你们能够指定出一个有限的迭代次数-,像我15年前学的,有穷的是重要的。
应用推荐