Tests:
  • ternary

    AخA
     
    for (let i = 0; i < 1000; i++) {
      const rnd = Math.random();
      const value = rnd < .5 ? 'min' : 'max'
    }
  • if

     
    for (let i = 0; i < 1000; i++) {
        const rnd = Math.random();
        let value;
        if (rnd < .5) {
            value = 'min';
        } else {
            value = 'max';
        }
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    ternary
    if

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 16 days ago)
Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Chrome 126 on Chrome OS 14541.0.0
View result in a separate tab
Test name Executions per second
ternary 51657.0 Ops/sec
if 49546.0 Ops/sec