Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Performance Test: substring vs substr vs slice vs split last index
(version: 1)
Comparing performance of:
slice vs substring vs split
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
var string = "I, am the, god of hellfire, and I bring, you..."
Tests:
slice
const ei = string.lastIndexOf(',') return string.slice(ei > 0 ? ei+1 : 0)
substring
const ei = string.lastIndexOf(',') return string.substring(ei+1)
split
return string.split(',').at(-1)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
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?