HTML Preparation code:
AخA
 
1
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.7.11/lodash.min.js'></script>
Script Preparation code:
x
 
function getRandomInt(max) {
  return Math.floor(Math.random() * Math.floor(max));
}
var values = [];
for(var i = 0; i < 1000; i++){
  values.push(getRandomInt(10000));
}
Tests:
  • old

     
    const result = [];
    for (let i = _.min(values); i <= _.max(values); i++) {
      result.push(i);
    }
    _.reverse(result);
  • new

     
    const startValue = Math.min(...values);
    const endValue = Math.max(...values); 
    const result = new Array(endValue - startValue);
    for (let value = endValue, index = 0; value >= startValue; value--, index++) {
      result[index] = value;
    }
    return result;
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    old
    new

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 5 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36
Chrome 81 on Mac OS X 10.14.6
View result in a separate tab
Test name Executions per second
old 20.0 Ops/sec
new 24352.7 Ops/sec