HTML Preparation code:
AخA
 
1
<script src="https://cdn.jsdelivr.net/npm/lodash/lodash.min.js"></script>
Script Preparation code:
x
 
var arr = [];
for (i = 0; i < 1000; i++) {
  arr[i] = i;
}
Tests:
  • Lodash

     
    var [met, rest] = _.partition(arr, function(i) { return i % 2 === 0 });
  • loop push

     
    var met = [];
    var rest = []; 
        for (var i = 0; i < arr.length; i++) {
            if (arr[i] % 2 === 0){
                met.push(arr[i]);}
            else {
                rest.push(arr[i]);  }
        }
  • filter

     
    var rest = [];
    arr = arr.filter(e => {
      if (e % 2 === 0) {
        return true;
      }
      else {
       rest.push(e);
        return false;
      }
    });
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Lodash
    loop push
    filter

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36
Chrome 117 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Lodash 286436.2 Ops/sec
loop push 9422.9 Ops/sec
filter 708961.2 Ops/sec