Math.min vs _.min vs d3.min on large array (v3)

Revision 3 of this benchmark created by Tom MacWright on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="https://raw.github.com/documentcloud/underscore/master/underscore.js"></script>
<script src="https://raw.github.com/mbostock/d3/master/d3.min.js"></script>
<script src="https://raw.github.com/tmcw/simple-statistics/master/src/simple_statistics.js"></script>

Setup

var arr = [], maxLimit = 1000000000;
    
    for (var i = 0; i < 100000; i++)
    {
        arr.push(Math.floor(Math.random() * maxLimit));
    }

Test runner

Ready to run.

Testing in
TestOps/sec
Math.min
Math.min.apply(Math, arr);
ready
Underscore.min
_.min(arr);
ready
D3.min
d3.min(arr);
ready
simple-statistics
ss.min(arr);
ready

Revisions

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