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 (Macintosh; Intel Mac OS X 10.15; rv:138.0) Gecko/20100101 Firefox/138.0
Browser:
Firefox 138
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
slice
270040800.0 Ops/sec
substr
264293904.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)