Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Speed Test: substring vs substr vs slice
(version: 1)
Comparing performance of:
slice vs substring vs substr
Created:
one year ago
by:
Guest
Go to the latest result
Script Preparation code:
var string = "I am the god of hellfire, and I bring you..."
Tests:
slice
var substring = string.slice(0, 25);
substring
var substring = string.substring(0, 25);
substr
var substring = string.substr(0, 25);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
slice
substring
substr
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0
Browser/OS:
Firefox 138 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
slice
132.5M/s
substring
132.0M/s
substr
130.1M/s
View exact numbers
Test name
Executions per second
✓
slice
132,537,216 Ops/sec
substring
132,017,464 Ops/sec
substr
130,137,344 Ops/sec
Related benchmarks
Performance Test: substring vs substr vs slice
Performance Test: substring vs substr vs slice (remove last char)
Performance Test: substring vs subsstr vs slice
Performance Test: substring vs substr vs slice constant length
JS substring vs slice
Comments
Confirm delete:
Do you really want to delete benchmark?