Tests:
  • for

    AخA
     
    const array = ['sdfsdfd', 'dsfwetwtwe', 'dsf1dsfdfsd', 'sdfdsfsdfsfsdf', 'sdfsdfd', 'dsf1wetwtwe', 'dsfdsfdfsd', 'sdfds1fsdfsfsdf', 'sdfsdfd', 'dsfwetwtwe', 'dsfdsfdfsd', 'sdfdsfsd1fsfsdf', 'sdfsdfd', 'dsfwetw1twe', 'dsfdsfdfsd', 'sdfdsfsdfsfsdf', 'sdfsdfd', 'dsfwetwtwe', 'dsfdsf1dfsd', 'sdfdsfsdfsfsdf']
    const final = []
    for (let i = 0; i < array.length; i++) {
        const item = array[i]
        if (item.includes('1')) {
            final.push(item)
        }
    }
  • filter

     
    const array = ['sdfsdfd', 'dsfwetwtwe', 'dsf1dsfdfsd', 'sdfdsfsdfsfsdf', 'sdfsdfd', 'dsf1wetwtwe', 'dsfdsfdfsd', 'sdfds1fsdfsfsdf', 'sdfsdfd', 'dsfwetwtwe', 'dsfdsfdfsd', 'sdfdsfsd1fsfsdf', 'sdfsdfd', 'dsfwetw1twe', 'dsfdsfdfsd', 'sdfdsfsdfsfsdf', 'sdfsdfd', 'dsfwetwtwe', 'dsfdsf1dfsd', 'sdfdsfsdfsfsdf']
    const final2 = array.filter(item => item.includes('1'))
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    for
    filter

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36 OPR/81.0.4196.37
Opera 81 on Windows
View result in a separate tab
Test name Executions per second
for 1152921.5 Ops/sec
filter 1159084.4 Ops/sec