Test name | Executions per second |
---|---|
_.max | 6410.8 Ops/sec |
Math.max | 12373.7 Ops/sec |
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.min.js'></script>
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
var arr = [];
for(var i = 0; i < 1000; i++){
arr.push({value:getRandomInt(100)});
}
_.max(arr);
Math.max(arr)