Smallest timeout value

JavaScript performance comparison

Revision 18 of this test case created

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.

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
 

Preparation code output

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 = 10
// async test
setTimeout(function() {
  deferred.resolve();
}, 10);
pending…
timeout = 40
// async test
setTimeout(function() {
  deferred.resolve();
}, 40);
pending…
timeout = 599147937792
// async test
setTimeout(function() {
  deferred.resolve();
}, 599147937792);
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