Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
RegExp vs startsWith
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:147.0) Gecko/20100101 Firefox/147.0
Browser:
Firefox 147
Operating system:
Windows
Device Platform:
Desktop
Date tested:
6 months ago
indexOf
796.9M/s
includes
793.0M/s
startsWith
479.8M/s
regexp
15.1M/s
View exact numbers
Test name
Executions per second
✓
indexOf
796,914,304 Ops/sec
includes
793,022,656 Ops/sec
startsWith
479,829,088 Ops/sec
regexp
15,099,987 Ops/sec
Tests:
regexp
const notAbsolute = (link) => !/^https?:\/\//.test(link); notAbsolute('https://www.measurethat.net/Benchmarks/Add') notAbsolute('http://www.measurethat.net/Benchmarks/Add') notAbsolute('/Benchmarks/Add')
startsWith
const notAbsolute = (link) => !link.startsWith('https://') && !link.startsWith('http://'); notAbsolute('https://www.measurethat.net/Benchmarks/Add') notAbsolute('http://www.measurethat.net/Benchmarks/Add') notAbsolute('/Benchmarks/Add')
includes
const notAbsolute = (link) => !link.includes('://'); notAbsolute('https://www.measurethat.net/Benchmarks/Add') notAbsolute('http://www.measurethat.net/Benchmarks/Add') notAbsolute('/Benchmarks/Add')
indexOf
const notAbsolute = (link) => link.indexOf('://') === -1; notAbsolute('https://www.measurethat.net/Benchmarks/Add') notAbsolute('http://www.measurethat.net/Benchmarks/Add') notAbsolute('/Benchmarks/Add')