Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Single vs multiple regex replace calls new new
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36
Browser:
Chrome 142
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
5 months ago
Test name
Executions per second
Multiple, regex
10915417.0 Ops/sec
Single, regex
12534915.0 Ops/sec
Script Preparation code:
var str = "Et inventore ut est. Illum dolorem similique odit. Velit necessitatibus unde nostrum sequi ut pariatur suscipit sit magnam. Cum esse sed quod aut id. Recusandae vel commodi."
Tests:
Multiple, regex
str = str.replace(/a/g, 'A').replace(/e/g,'E')
Single, regex
str = str.replace(/a|e/g, match => match === 'a' ? 'A' : 'B')