Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:137.0) Gecko/20100101 Firefox/137.0
Firefox 137
Mac OS X 10.15
Desktop
18 days ago
Test name Executions per second
new RegExp() 8519526.0 Ops/sec
Literal 15364923.0 Ops/sec
Script Preparation code:
AخA
 
const str = '132abc67219f019afe12901a'
Tests:
  • new RegExp()

     
    new RegExp('^[0-9a-fA-F]{24}$').test(str)
  • Literal

     
    /^[0-9a-fA-F]{24}$/.test('132abc67219f019afe12901a')