Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
replace string check
(version: 1)
Comparing performance of:
regex vs replace vs substring
Created:
10 months ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const regexReplace = (value) => { const experimentName = value.replace(/^exp_/, ''); } const replace = (value) => { const experimentName = value.replace('exp', ''); } const substring = (value) => { const experimentName = value.substring(3); }
Tests:
regex
regexReplace("exp_abc")
replace
replace("exp_abc")
substring
substring("exp_abc")
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
regex
replace
substring
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
10 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
Browser/OS:
Chrome 138 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
regex
41042300.0 Ops/sec
replace
49321344.0 Ops/sec
substring
233790528.0 Ops/sec
Related benchmarks:
REPLACE STRSUBTR VS REGEX REPLACE
Asterisk map replace vs regex replace
Asterisk map replace vs stored regex replace vs make an array replace
Triple replace instead of regex
string replaceAll test
replace 2 type regex
compate splitjoin relaceregrex replaceall
sa sad test
rgx replace with if
Comments
Confirm delete:
Do you really want to delete benchmark?