sort/filter order

Benchmark created on


Setup

var arr = [],
        i, str = "abcdefghijklmnopqrstuvwxyz";
    
    for (i = 0; i < 1000000; i++) {
      arr.push(str.charAt(i % 26) + str);
    }

Test runner

Ready to run.

Testing in
TestOps/sec
sort-filter
arr.sort().filter(function(s){return s.indexOf('a')===0;});
ready
filter-sort
arr.filter(function(s){return s.indexOf('a')===0;}).sort();
ready

Revisions

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