Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
first upper case extended 1
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 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0
Browser:
Firefox 128
Operating system:
Linux
Device Platform:
Desktop
Date tested:
11 months ago
slice
1642.2M/s
substring charAt
1577.6M/s
substr charAt
1414.6M/s
slice charAt
1413.1M/s
substring
1408.1M/s
substr
1387.2M/s
View exact numbers
Test name
Executions per second
✓
slice
1,642,171,648 Ops/sec
substring charAt
1,577,564,800 Ops/sec
substr charAt
1,414,611,456 Ops/sec
slice charAt
1,413,102,592 Ops/sec
substring
1,408,095,744 Ops/sec
substr
1,387,212,416 Ops/sec
Script Preparation code:
const example = 'there is no spoon'
Tests:
slice charAt
const firstUpper = (string_)=>(string_.charAt(0).toUpperCase() + string_.slice(1)); const result = firstUpper(example);
substr charAt
const firstUpper = (string_)=>(string_.charAt(0).toUpperCase() + string_.substr(1)); const result = firstUpper(example);
substring charAt
const firstUpper = (string_)=>(string_.charAt(0).toUpperCase() + string_.substring(1)); const result = firstUpper(example);
slice
const firstUpper = (string_)=>(string_[0].toUpperCase() + string_.slice(1)); const result = firstUpper(example);
substr
const firstUpper = (string_)=>(string_[0].toUpperCase() + string_.substr(1)); const result = firstUpper(example);
substring
const firstUpper = (string_)=>(string_[0].toUpperCase() + string_.substring(1)); const result = firstUpper(example);