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:
2 months ago
Test name
Executions per second
regexp
15099987.0 Ops/sec
startsWith
479829088.0 Ops/sec
includes
793022656.0 Ops/sec
indexOf
796914304.0 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')