Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
split vs exec vs replace
Test String.split vs RegEx.exec (and String.match) vs String.replace
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/131.0.0.0 Safari/537.36
Browser:
Chrome 131
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
String.split
6.8M/s
String.replace
6.4M/s
RegEx.exec
3.8M/s
String.match
3.5M/s
View exact numbers
Test name
Executions per second
✓
String.split
6,831,858 Ops/sec
String.replace
6,390,210 Ops/sec
RegEx.exec
3,763,465 Ops/sec
String.match
3,536,958 Ops/sec
Script Preparation code:
str = "1875 Tokens"; re = /(\d+)\sTokens/;
Tests:
String.split
str.split(" ")[0]
String.match
str.match(re)[1]
RegEx.exec
re.exec(str)[1]
String.replace
str.replace(' Tokens', '')