Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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:
2 years ago
Benchmark engine:
Benchmark.js
slice index
163.6M/s
substr index access
162.9M/s
slice charat
103.9M/s
substr charAt access
102.1M/s
replace
25.0M/s
View exact numbers
Test name
Executions per second
✓
slice index
163,643,344 Ops/sec
substr index access
162,876,128 Ops/sec
slice charat
103,859,592 Ops/sec
substr charAt access
102,118,224 Ops/sec
replace
24,952,670 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(/\/+$/, '');