Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Trim last char2
(version: 3)
Comparing performance of:
Regex replace vs Slice vs Substring vs Split
Created:
2 years ago
by:
Registered User
Jump to the latest result
Tests:
Regex replace
const result = 'item$'.replace(/\$$/, '');
Slice
const result = 'item$'.slice(0, 'item$'.length-1);
Substring
const result = 'item$'.substring(0, 'item$'.length-1);
Split
const result = 'item$'.split('$', 2)[0]
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
Regex replace
Slice
Substring
Split
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?