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 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0
Browser:
Firefox 141
Operating system:
Windows
Device Platform:
Desktop
Date tested:
9 months ago
Test name
Executions per second
Multiple, regex
12562880.0 Ops/sec
Single, regex
7822679.5 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')