Test name | Executions per second |
---|---|
new RegExp() | 21213728.0 Ops/sec |
Literal | 21296956.0 Ops/sec |
new RegExp(Literal) | 15380806.0 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}$/)