Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Last char trim speed
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Browser:
Chrome 127
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
substr index access
162876128.0 Ops/sec
substr charAt access
102118224.0 Ops/sec
slice index
163643344.0 Ops/sec
slice charat
103859592.0 Ops/sec
replace
24952670.0 Ops/sec
Tests:
substr index access
let matchstring = '?really just a string/'; let lastChar = matchstring[matchstring.length -1]; if (lastChar === '/') { let result = matchstring.substring(0, -1); }
substr charAt access
let matchstring = '?really just a string/'; let lastChar = matchstring.charAt(-1); if (lastChar === '/') { let result = matchstring.substring(0, -1); }
slice index
let matchstring = '?really just a string/'; let lastChar = matchstring[matchstring.length -1]; if (lastChar === '/') { let result = matchstring.slice(0, -1); }
slice charat
let matchstring = '?really just a string/'; let lastChar = matchstring.charAt(-1); if (lastChar === '/') { let result = matchstring.slice(0, -1); }
replace
let matchstring = '?really just a string/'; let result = matchstring.replace(/\/+$/, '');