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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 Edg/132.0.0.0
Browser:
Chrome 132
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Benchmark engine:
Benchmark.js
replace
8.3M/s
replace all
6.3M/s
split + join
4.1M/s
View exact numbers
Test name
Executions per second
✓
replace
8,283,736 Ops/sec
replace all
6,286,080 Ops/sec
split + join
4,076,932 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, '_')