Parsing (v3)

Revision 3 of this benchmark created on


Setup

const u = "javascript:test()"
const jsProtocolPrefix = "javascript:";
const jsProtocolRegex = /^javascript:/i;
const jsProtocolRegex2 = /^\s*javascript:/i

Test runner

Ready to run.

Testing in
TestOps/sec
strings
const value = u.toLowerCase().trim().substring(0, jsProtocolPrefix.length) === jsProtocolPrefix
ready
regex
const value = jsProtocolRegex.test(u.trim());
ready
regex2
const value = jsProtocolRegex2.test(u)
ready

Revisions

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