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:
5 months ago
Literal RegExps
26.3M/s
Constructed RegExps
4.5M/s
View exact numbers
Test name
Executions per second
✓
Literal RegExps
26,250,526 Ops/sec
Constructed RegExps
4,471,308 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'))