regex vs. string equals

Benchmark created by Jens Roland on


Test runner

Ready to run.

Testing in
TestOps/sec
Google version
var g_proto = ('https:' == document.location.protocol ? 'https:' : 'http:');
ready
Agillic version
var a_proto = (/^http:/.test(document.location) ? "http" : "https");
ready

Revisions

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