Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.67 Safari/537.36 Edg/87.0.664.47
Chrome 87
Windows
Desktop
4 years ago
Test name Executions per second
Regular Expression Literal: 2784560.5 Ops/sec
split and join 1603118.6 Ops/sec
Regular Expression: 1417604.0 Ops/sec
while replace includes 6590677.0 Ops/sec
while replace indexOf 6650504.5 Ops/sec
Script Preparation code:
Tests:
  • Regular Expression Literal:

  • split and join

  • Regular Expression:

  • while replace includes

  • while replace indexOf