Setinterval Performance
Possible Duplicate: Javascript: setInterval() behaviour with 0 milliseconds I simply want to hear, if it is a problem having a setInterval with time set to 0 milliseconds? Will
Solution 1:
if it is a problem having a setInterval with time set to 0 milliseconds?
You can't set 0 as the interval, as the browser will ignore it.
Will there be any performance issues? And will it be better to have e.g. 1000 milliseconds?
Of course 1000 milliseconds is better than 10(not zero) if it's possible. Doing a thing every 10 ms costs you more than doing that exact thing only once 1000 ms.
Solution 2:
Javascript is not multithreaded, it just simulates it with delayed execution. When the timer reaches your timeout interval, it will pause all other execution and run the code you told it to. Because of this, you might want to be careful about how short your interval is. It will probably tank your browser if you aren't careful.
Post a Comment for "Setinterval Performance"