Benchmark.js test page | jsPerf
Description: This is just a test document for Benchmark.js.

# Benchmark.js test page

## JavaScript performance comparison

Test case created by Mathias 40 seconds ago and last updated 12 seconds ago

## Info

This is just a test document for Benchmark.js.

## Preparation code

    <div>Lorem ipsum</div>
    <script>
      var arr = [1, 5, 4, 2, 3];

      function init() {
        window.console && console.log('init called');
      }
    </script>
    <script>
    Benchmark.prototype.setup = function() {
      window.foo = 42;
      var x = arr;
    };

    Benchmark.prototype.teardown = function() {
      window.foo = 24;
    };
    </script>

## Preparation code output

Lorem ipsum

## Test runner

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

Testing in
Test | Ops/sec
--- | ---
Normal |
    x.sort(function(a, b) {
      return a - b;
    });
Exit Early |
    x.sort(function(a, b) {
      return a - b;
    });
    return;
Async |
    // async test
    setTimeout(function() {
      deferred.resolve();
    }, 10);
Error |
    x.foo(); // unknown method
Comments |
    // comments at start
    x.reverse().sort(function(a, b) {
      return a - b;
    });
    // comments at end

You can edit these tests or add even more tests to this page by appending `/edit` to the URL.

## Compare results of other browsers

# 0 comments

## Add a comment

Name *
Email * (only used for Gravatar)
URL
Message *Markdown syntax is allowed