Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Javascript Slice vs String Index Addition
(version: 0)
Comparing performance of:
Slice vs String addition
Created:
3 years ago
by:
Guest
Jump to the latest result
Tests:
Slice
const s = "this is a test string" let newString = s.slice(0, 5)
String addition
const s = "this is a test string" let newString = s[0] + s[1] + s[2] + s[3] + s[4] + s[5]
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Slice
String addition
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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
Browser/OS:
Chrome 125 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Slice
193962736.0 Ops/sec
String addition
189406048.0 Ops/sec
Related benchmarks:
Performance Test: indexOf + slice vs split
Javascript slice vs substring
slice vs substr vs substring 122459
JS substring vs slice
Performance Test: substring vs substr vs slice with StartIndex
Comments
Confirm delete:
Do you really want to delete benchmark?