Smallest timeout value

JavaScript performance comparison

Revision 13 of this test case created by Jasper

Info

The smallest setTimeout timeout value allowed by the HTML5 specification is 4 ms. Smaller values should clamp to 4 ms.

Therefore, the first two tests below should have about the same result.

P.S. Some browsers freak out when you use a value greater than 599147937791 for the timeout (i.e. they use 0 or 4 ms instead), hence the last test.

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
timeout = 0
// async test
setTimeout(function() {
  deferred.resolve();
}, 0);
pending…
timeout = 4
// async test
setTimeout(function() {
  deferred.resolve();
}, 4);
pending…
timeout = 6
// async test
setTimeout(function() {
  deferred.resolve();
}, 6);
pending…
timeout = 8
// async test
setTimeout(function() {
  deferred.resolve();
}, 8);
pending…
timeout = 10
// async test
setTimeout(function() {
  deferred.resolve();
}, 10);
pending…
timeout = 12
// async test
setTimeout(function() {
  deferred.resolve();
}, 12);
pending…
timeout=14
// async test
setTimeout(function() {
  deferred.resolve();
}, 14);
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment