Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
slice substring trim both ends
Compares slice and substring to each other when trimming 1 character from both ends of a string
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Browser:
Chrome 134
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
slice
205809056.0 Ops/sec
substr
187596448.0 Ops/sec
Script Preparation code:
var example = 'there is no spoon'
Tests:
slice
var result = example.slice(1,-1)
substr
var result = example.substring(1, example.length-1)