eval vs regex

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
eval
constparseUrl = "https://www.example.com"
parsedUrl.protocol === "https:" || parsedUrl.protocol === "http:";
ready
regex
constparseUrl = "https://www.example.com"
/^https?:$/.test(parsedUrl.protocol);
ready

Revisions

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