Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Chrome 121
Linux
Desktop
10 months ago
Test name Executions per second
new RegExp() 7416084.5 Ops/sec
Literal 7604629.0 Ops/sec
Script Preparation code:
AخA
 
var reConstructor = new RegExp('^[0-9a-fA-F]{24}$')
var reLiteral = /^[0-9a-fA-F]{24}$/
Tests:
  • new RegExp()

     
    reConstructor.test('132abc67219f019afe12901a')
  • Literal

     
    reLiteral.test('132abc67219f019afe12901a')