This content has been marked as final. Show 5 replies
look into setInterval();
Don't think setInterval will work here.
What I usually do is put this before the block or function:
and this at the end:
Not too elegant, but it lets me compare things. Of course sometimes you have to make the code execute many times to get a good approximation. Like when timing different versions of the shuffle() prototype I would routinely shuffle arrays of 10,000 or so elements.
Also sometimes I will time both versions at once and then switch the order of their execution to see if that affects anything.
This is exactly what I was looking for, many thanks, I'll try it out and let you know.
ah i read it wrong oops! need more coffee good luck
Now coffee there is something that can be handled with setInterval!
Yes, every 100 milliseconds! and I didn't give it a variable reference because I never intend to clear it!