indexof vs regex for email

Benchmark created by Glade on


Setup

var rx = /.*@.*\..*/;
  var str = "a@b.c";

Test runner

Ready to run.

Testing in
TestOps/sec
indexOf
str.indexOf("@") > -1;
ready
regex
str.match(rx);
ready

Revisions

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