native sort vs underscore sortBy (v10)

Revision 10 of this benchmark created on


Preparation HTML

<script src="http://documentcloud.github.com/underscore/underscore-min.js"></script>

<script>
  var labels = [{name:"elliot"}, {name:"steve"}, {name:"dhruv"}, {name:"guiga"}, {name:"rajat"}, {name:"rob"}];
  
  function nativeSort() {
  labels.sort(function(a, b) {
   return a.name <= b.name ? -1 : 1;
  });
  }
  
  function uSort() {
  _(labels).sortBy(function(label) {
      return label.name;
  });
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
native sort
nativeSort();
ready
underscore sortBy
uSort();
ready

Revisions

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