Test name | Executions per second |
---|---|
new RegExp() | 2714396.2 Ops/sec |
Literal | 2406546.5 Ops/sec |
new RegExp(Literal) | 1325366.8 Ops/sec |
var reConstructor = new RegExp('^[0-9a-fA-F]{24}$')
var reLiteral = /^[0-9a-fA-F]{24}$/
var reConstLiteral = new RegExp(/^[0-9a-fA-F]{24}$/)
reConstructor.test('132abc67219f019afe12901a')
reLiteral.test('132abc67219f019afe12901a')
var reConstLiteral = new RegExp(/^[0-9a-fA-F]{24}$/)