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 with callback vs replaceAll with callback
Comparing performance of: split + join vs replace with callback vs replaceAll with callback
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36 Edg/151.0.0.0
Browser:
Chrome 151
Operating system:
Windows
Device Platform:
Desktop
Date tested:
22 days ago
Benchmark engine:
Benchmark.js
replace
4.7M/s
split + join
4.4M/s
replace all
3.4M/s
View exact numbers
Test name
Executions per second
✓
replace
4,718,192 Ops/sec
split + join
4,391,559 Ops/sec
replace all
3,444,510 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, () => '$')