_.indexOf pr2105

JavaScript performance comparison

Revision 3 of this test case created by Justin Ridgewell

Preparation code

<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore.js"></script>
<script src="https://cdn.rawgit.com/jashkenas/underscore/master/underscore.js"></script>
<script>var edge = _.noConflict();</script>
<script src="https://cdn.rawgit.com/jridgewell/underscore/5eb405c/underscore.js"></script>
<script>var pr = _.noConflict();</script>
      
<script>
Benchmark.prototype.setup = function() {
  var array = _.range(1000);

};
</script>

Preparation code output

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
indexOf (stable)
var r = _.indexOf(array, 999);
pending…
indexOf (master)
var r = edge.indexOf(array, 999);
pending…
indexOf (pr)
var r = pr.indexOf(array, 999);
pending…
indexOf (stable,start)
var r = _.indexOf(array, 999, 100);
pending…
indexOf (master,start)
var r = edge.indexOf(array, 999, 100);
pending…
indexOf (pr,start)
var r = pr.indexOf(array, 999, 100);
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.

0 Comments