Benchmark.js test page

Benchmark created by Mathias Bynens on


Description

This is just a test document for Benchmark.js.

Preparation HTML

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

  function init() {
    window.console && console.log('init called');
  }
</script>

Setup

window.foo = 42;
    var x = arr;

Teardown


    window.foo = 24;
  

Test runner

Ready to run.

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

Revisions

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

  • Revision 1: published by Mathias Bynens on