test vs match

Benchmark created on


Preparation HTML

<script>
  var type = 'bookmarks',
      regexp_s = /^products|bookmarks|recent|search$/,
      regexp = /products|bookmarks|recent|search/;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
test
/products|bookmarks|recent|search/.test(type)
ready
match
type.match(/products|bookmarks|recent|search/)
ready
test predef
regexp.test(type)
ready
test predef sharp
regexp_s.test(type)
ready
match predef
type.match(regexp)
ready

Revisions

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