indexOf vs regex for protocol independent URL (v2)

Revision 2 of this benchmark created by Alexis Deveria on


Test runner

Ready to run.

Testing in
TestOps/sec
indexOf
"//connect.facebook.net/en_US/all.js".indexOf('//') === 0;
ready
regular expression
/^\/\//.test("//connect.facebook.net/en_US/all.js");
ready

Revisions

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

  • Revision 1: published by Ralph Holzmann on
  • Revision 2: published by Alexis Deveria on