Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Comparing performance of: split + join vs replace vs replaceAll
Comparing performance of: split + join vs replace vs replaceAll
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:144.0) Gecko/20100101 Firefox/144.0
Browser:
Firefox 144
Operating system:
Linux
Device Platform:
Desktop
Date tested:
10 months ago
Benchmark engine:
Benchmark.js
replace
2.4M/s
replace all
2.2M/s
split + join
1.7M/s
View exact numbers
Test name
Executions per second
✓
replace
2,409,342 Ops/sec
replace all
2,170,756 Ops/sec
split + join
1,667,954 Ops/sec
Script Preparation code:
var example = 'Agreement Change Id'
Tests:
split + join
var result = example.split(/\s/g).join('_');
replace
var result = example.replace(/\s/g, '_')
replace all
var result = example.replaceAll(/\s/g, '_')