Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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:
one year ago
Benchmark engine:
Benchmark.js
Regex
443.5M/s
regex neg
401.5M/s
endsWith
50.5M/s
endsWith neg
48.3M/s
View exact numbers
Test name
Executions per second
✓
Regex
443,450,176 Ops/sec
regex neg
401,532,608 Ops/sec
endsWith
50,494,660 Ops/sec
endsWith neg
48,346,952 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)