Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
endsWith slice vs Regex replace
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPad; CPU OS 18_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3 Mobile/15E148 Safari/604.1
Browser:
Mobile Safari 18
Operating system:
iOS 18.3
Device Platform:
Tablet
Date tested:
9 months ago
Test name
Executions per second
Regex
443450176.0 Ops/sec
endsWith
50494660.0 Ops/sec
regex neg
401532608.0 Ops/sec
endsWith neg
48346952.0 Ops/sec
Tests:
Regex
const str = "test/"; str.replace(/\/$/, '')
endsWith
const str = "test/"; if (str.endsWith('/')) str.slice(0, -1)
regex neg
const str = "test"; str.replace(/\/$/, '')
endsWith neg
const str = "test"; if (str.endsWith('/')) str.slice(0, -1)