Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
RegExp constructor vs inline literal
Testing performance when using a new RegExp object vs a literal regex
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Browser:
Chrome 136
Operating system:
Linux
Device Platform:
Desktop
Date tested:
11 months ago
Test name
Executions per second
new RegExp()
4832716.5 Ops/sec
Inline literal
4536432.5 Ops/sec
Script Preparation code:
var reConstructor = new RegExp('^[0-9a-fA-F]{24}$')
Tests:
new RegExp()
reConstructor.test('132abc67219f019afe12901a')
Inline literal
/^[0-9a-fA-F]{24}$/.test('132abc67219f019afe12901a')