Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Replace performace
(version: 1)
Comparing performance of:
replace global vs split - join vs replaceAll
Created:
14 days ago
by:
Guest
Go to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
/*your preparation JavaScript code goes here To execute async code during the script preparation, wrap it as function globalMeasureThatScriptPrepareFunction, example:*/ async function globalMeasureThatScriptPrepareFunction() { // This function is optional, feel free to remove it. // await someThing(); }
Tests:
replace global
'f44c1091-1822-478b-83a3-4283aed209c0'.replace(new RegExp('-', 'g'), '').toUpperCase();
split - join
'f44c1091-1822-478b-83a3-4283aed209c0'.split('-').join().toUpperCase();
replaceAll
'f44c1091-1822-478b-83a3-4283aed209c0'.replaceAll('-', '').toUpperCase();
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
replace global
split - join
replaceAll
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
14 days ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:152.0) Gecko/20100101 Firefox/152.0
Browser/OS:
Firefox 152 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
replaceAll
21.8M/s
split - join
13.5M/s
replace global
9.1M/s
View exact numbers
Test name
Executions per second
✓
replaceAll
21,764,742 Ops/sec
split - join
13,532,955 Ops/sec
replace global
9,054,725 Ops/sec
Related benchmarks
Splti vs Trim vs replace className
includes vs. word starts with
replace test number vs parseint
String comp
=== vs reges
IS using regexes faster for string replace
bm1234
Test Test Test Test
multiply
Comments
Confirm delete:
Do you really want to delete benchmark?