Compare regexp vs literal creation and test

4 years ago
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36
Test name Executions per second
using new RegExp() 2228457.0 Ops/sec
using literal 8483451.0 Ops/sec
Tests:
  • using new RegExp()

  • using literal

Open this result on MeasureThat.net