Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36
Chrome 91
Mac OS X 10.14.6
Desktop
3 years ago
Test name Executions per second
if else if 50774.6 Ops/sec
if else 3456930.0 Ops/sec
if if 4013424.8 Ops/sec
switch case 54333.7 Ops/sec
indexOf 57985.8 Ops/sec
if != && 57851.7 Ops/sec
if == && 61221.7 Ops/sec
if != || 55950.5 Ops/sec
if || 57870.2 Ops/sec
if if if ... 56869.9 Ops/sec
Script Preparation code:
Tests:
  • if else if

  • if else

  • if if

  • switch case

  • indexOf

  • if != &&

  • if == &&

  • if != ||

  • if ||

  • if if if ...