Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
slice vs substr vs substring (with start and end index, and with emoji)
Compares slice, substr and substring to each other when there is only a start index
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/122.0.0.0 Safari/537.36
Browser:
Chrome 122
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
substring
16.9M/s
slice
16.7M/s
substr
16.6M/s
View exact numbers
Test name
Executions per second
✓
substring
16,912,784 Ops/sec
slice
16,725,559 Ops/sec
substr
16,621,867 Ops/sec
Script Preparation code:
var example = '👶'.repeat(10000)
Tests:
slice
var result = example.slice(100,1000)
substr
var result = example.substr(100,1000)
substring
var result = example.substring(100,1000)