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:
8 months ago
Test name
Executions per second
slice charAt
1413102592.0 Ops/sec
substr charAt
1414611456.0 Ops/sec
substring charAt
1577564800.0 Ops/sec
slice
1642171648.0 Ops/sec
substr
1387212416.0 Ops/sec
substring
1408095744.0 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);