Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36
Chrome 92
Windows 7
Desktop
3 years ago
Test name Executions per second
if else if 183851.2 Ops/sec
if else 4227171.5 Ops/sec
if if 4317981.5 Ops/sec
switch case 192234.1 Ops/sec
indexOf 199586.3 Ops/sec
if != && 176254.9 Ops/sec
if == && 193358.5 Ops/sec
if != || 193650.8 Ops/sec
if || 184538.0 Ops/sec
if if if ... 169922.0 Ops/sec
Script Preparation code:
Tests:
  • if else if

  • if else

  • if if

  • switch case

  • indexOf

  • if != &&

  • if == &&

  • if != ||

  • if ||

  • if if if ...