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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Browser:
Chrome 136
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Regex
37401988.0 Ops/sec
endsWith
205447504.0 Ops/sec
regex neg
50971612.0 Ops/sec
endsWith neg
166809680.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)