Script Preparation code:
AخA
 
var arr = [1,2,3,4,5,6,7,8,9,0], farr, i,len;
Tests:
  • Filter

     
    farr = arr.filter(function(item) { 
      return (item>4); 
    });
  • For

     
    for (i=0,len=arr.length;i<len;i++) {
      if (arr[i]<5) continue;
      farr.push(arr[i]);
    }
  • For 2

     
    for (i=0,len=arr.length;i<len;i++) {
      if (arr[i]>4) farr.push(arr[i]);
    }
  • For in

     
    for (i in arr) {
      if (arr[i]>4) farr.push(arr[i]);
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Filter
    For
    For 2
    For in

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 months ago)
Mozilla/5.0 (X11; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0
Firefox 132 on Linux
View result in a separate tab
Test name Executions per second
Filter 16019515.0 Ops/sec
For 3186558.5 Ops/sec
For 2 3250406.2 Ops/sec
For in 1208180.8 Ops/sec