Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Literal vs Constructor RegExp
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 144
Operating system:
Android
Device Platform:
Mobile
Date tested:
2 months ago
Test name
Executions per second
Literal RegExps
26250526.0 Ops/sec
Constructed RegExps
4471307.5 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
var elements = Array.of(1000000).fill(0) var literalRegexps = elements.map(() => /a/) var constructedRegexps = elements
Tests:
Literal RegExps
literalRegexps.forEach((r) => r.test('aaaa'))
Constructed RegExps
constructedRegexps.forEach((r) => new RegExp('a'.replace(/a/g, 'b')).test('aaaa'))