uniq/sort versus sort/uniq

Benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="//underscorejs.org/underscore-min.js"></script>

Setup

foo=[1,7,5,3,4,6,9,0,3,7,5,1,3,0,5,8,7,2,4,3,1,7,5,4,9,8,5,4,0,8,9,2,7,4,8,5,1];

Test runner

Ready to run.

Testing in
TestOps/sec
uniq/sort
_.uniq(foo).sort();
ready
sort/uniq
_.uniq(foo.sort());
ready

Revisions

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