Sort using functions

Benchmark created on


Preparation HTML

<script>
  var func = function (a, b) { return a < b; };
  var array = [];
  for(var i = 0, len = 1000; i < len; i++)
  {
    array.push(i);
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
sort using functions
[1, 2, 3, 4, 5, 6].sort(func);
ready
sort using built-in
[1, 2, 3, 4, 5, 6].sort();
ready
function with more data
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15].sort(func);
ready
builtin with more data
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15].sort();
ready
and 1000 func
array.sort(func);
ready
and 1000 native
array.sort();
ready

Revisions

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