Tests:

Historical Performance Data aggregated from 17 community runs

Desktop Results:
Chrome 17 runs
With if statements
170.4M/s
With ternary operator #2
165.1M/s
With ternary operator #1
162.4M/s
With inline statements
162.2M/s
With min() and max()
8.7M/s

Fastest: With if statements (19.6x faster)

View exact numbers
  • With if statements: 170,417,792 ops/sec
  • With ternary operator #2: 165,053,248 ops/sec
  • With ternary operator #1: 162,430,608 ops/sec
  • With inline statements: 162,169,600 ops/sec
  • With min() and max(): 8,712,377 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    With inline statements
    With min() and max()
    With if statements
    With ternary operator #1
    With ternary operator #2

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 5 months ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36
Chrome 146 on Mac OS X 10.15.7
View result in a separate tab
With ternary operator #1
263.1M/s
With if statements
261.6M/s
With min() and max()
259.6M/s
With ternary operator #2
251.9M/s
With inline statements
245.5M/s
View exact numbers
Test name Executions per second
With ternary operator #1 263,057,472 Ops/sec
With if statements 261,649,552 Ops/sec
With min() and max() 259,584,048 Ops/sec
With ternary operator #2 251,894,992 Ops/sec
With inline statements 245,488,112 Ops/sec