Search: RegExp vs Regex String

Benchmark created by Eyal Shilony on


Setup

var url = "foo/bar/1"

Test runner

Ready to run.

Testing in
TestOps/sec
RegExp
var regex = new RegExp("^\\w+/\\w+/\\d+$", "i");

url.search(regex);
ready
Regex String
url.search("^\\w+/\\w+/\\d+$");
ready

Revisions

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

  • Revision 1: published by Eyal Shilony on