Whats faster in Javascript a bunch of small setInterval loops, or one big one?
Posted
by RobertWHurst
on Stack Overflow
See other posts from Stack Overflow
or by RobertWHurst
Published on 2010-04-27T05:27:10Z
Indexed on
2010/04/27
5:33 UTC
Read the original article
Hit count: 316
Just wondering if its worth it to make a monolithic loop function or just add loops were they're needed.
The big loop option would just be a loop of callbacks that are added dynamically with an add function.
adding a function would look like this
setLoop(function(){
alert('hahaha! I\'m a really annoying loop that bugs you every tenth of a second');
});
setLoop would add the function to the monolithic loop.
so is the is worth anything in performance or should I just stick to lots of little loops using setInterval?
© Stack Overflow or respective owner