Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 Edg/138.0.0.0
Chrome 138
Windows
Desktop
one year ago
Benchmark.js
With if statements
90.8M/s
With ternary operator #2
90.4M/s
With inline statements
88.6M/s
With min() and max()
86.4M/s
With ternary operator #1
83.8M/s
View exact numbers
Test name Executions per second
With if statements 90,814,128 Ops/sec
With ternary operator #2 90,412,616 Ops/sec
With inline statements 88,610,456 Ops/sec
With min() and max() 86,392,992 Ops/sec
With ternary operator #1 83,781,088 Ops/sec
Tests: