Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:96.0) Gecko/20100101 Firefox/96.0
Firefox 96
Windows
Desktop
2 years ago
Test name Executions per second
lorem.startsWith("L"); 62995012.0 Ops/sec
lorem.indexOf("L") === 0; 41490624.0 Ops/sec
LOREM_RE.test(lorem); 33944880.0 Ops/sec
lorem.startsWith("R"); 62369008.0 Ops/sec
lorem.indexOf("R") === 0; 26896312.0 Ops/sec
ROLEM_RE.test(lorem); 38925540.0 Ops/sec
lorem && lorem[0] === "L"; 927905408.0 Ops/sec
Script Preparation code:
Tests:
  • lorem.startsWith("L");

  • lorem.indexOf("L") === 0;

  • LOREM_RE.test(lorem);

  • lorem.startsWith("R");

  • lorem.indexOf("R") === 0;

  • ROLEM_RE.test(lorem);

  • lorem && lorem[0] === "L";