Mr

JavaScript performance comparison

Test case created by Luke Wilde and last updated

Info

The performance difference between native and lodash's version of indexOf

Preparation code

<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.3.1/lodash.min.js">
</script>
<script>
Benchmark.prototype.setup = function() {
    var numbers = [];
   
    for (var i = 0; i < 10000; i++) {
      numbers.push(i);
    }
};

Benchmark.prototype.teardown = function() {
    numbers = null
};
</script>

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
lodash int
_.indexOf(numbers, 5000)
pending…
native int
numbers.indexOf(5000)
pending…

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