Tests:
  • branched

    x
     
    const a = 5
    const b = 2
    const max = (a, b) => {
        if (a > b) {
            return a
        }
        return b
    }
    max(a, b)
  • ternary

     
    const a = 5
    const b = 2
    const max = (a, b) => a > b ? a : b
    max(a, b)
  • math

     
    const a = 5
    const b = 2
    const max = (a, b) => a * (a > b) + b * (b > a)
    max(a, b)
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    branched
    ternary
    math

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 years ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
Chrome 83 on Linux
View result in a separate tab
Test name Executions per second
branched 868210176.0 Ops/sec
ternary 868451008.0 Ops/sec
math 863787392.0 Ops/sec