Array Sort vs. lodash sort (v8)

Revision 8 of this benchmark created on


Preparation HTML

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>

Setup

var jsArrayTest = [];
    for (var i = 1000; i > 0; i--) {
      jsArrayTest.push(_.random(-1000, 1000))
    }
    var lodashArrayTest = _.cloneDeep(jsArrayTest);
    var testArray = _.cloneDeep(jsArrayTest);

Test runner

Ready to run.

Testing in
TestOps/sec
JS Array sort
testArray.sort(function compare(a, b) { return a - b });
ready
loDash
_.sortBy(lodashArrayTest, function(x) {
  return x;
});
ready

Revisions

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