starts with http

Benchmark created on


Preparation HTML

<script>
window.testStrings = [
	"/absolute/path",
	"relative/path",
	"/another/absolute/path",
	"https",
	"http"
];
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
regex
const startsWithHttp = /^http/;

window.testStrings.forEach(path => {
	path.match(startsWithHttp);
});
ready
substring
window.testStrings.forEach(path => {
	path.substring(0, 3) === "http";
});
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.