Smallest timeout value

JavaScript performance comparison

Revision 27 of this test case created


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

function Callback()
Benchmark.prototype.setup = function() {
    d = deferred;

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(Callback, 0);
timeout = 4
// async test
setTimeout(Callback, 4);
timeout = 10
// async test
setTimeout(Callback, 10);
timeout = 40
// async test
setTimeout(Callback, 40);
timeout = 599147937792
// async test
setTimeout(Callback, 599147937792);

Compare results of other browsers


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:


Comment form temporarily disabled.

Add a comment