Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.22 Safari/537.36
Chrome 102
Windows
Desktop
2 years ago
Test name Executions per second
if else if 46957.8 Ops/sec
if else 2927096.0 Ops/sec
if if 2911446.0 Ops/sec
switch case 52770.6 Ops/sec
indexOf 55615.2 Ops/sec
if != && 51192.6 Ops/sec
if == && 56691.4 Ops/sec
if != || 56417.9 Ops/sec
if || 50021.6 Ops/sec
if if if ... 47212.7 Ops/sec
Script Preparation code:
Tests:
  • if else if

  • if else

  • if if

  • switch case

  • indexOf

  • if != &&

  • if == &&

  • if != ||

  • if ||

  • if if if ...