Script Preparation code:
AخA
 
arr = Array.from({ length: 10000 }, () => Math.random())
Tests:
  • if

     
    let v = 2;
    for (const x of arr) {
        if (x < v) v = x;
    }
    return v;
  • Math.min

     
    let v = 2;
    for (const x of arr) {
        v = Math.min(v, x);
    }
    return v;
  • Cached min

     
    const min = Math.min;
    let v = 2;
    for (const x of arr) {
        v = min(v, x);
    }
    return v;
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    if
    Math.min
    Cached min

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (iPhone; CPU iPhone OS 17_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1.1 Mobile/15E148 Safari/604.1
Mobile Safari 17 on iOS 17.1.1
View result in a separate tab
Test name Executions per second
if 46626.6 Ops/sec
Math.min 1043.7 Ops/sec
Cached min 21867.5 Ops/sec