use Benchmark qw(cmpthese :hireswallclock);
use Sub::Name;

my $foo = do {
  open my $fh, "<", $ARGV[0] || "/usr/share/doc/pcre/pcre.txt" or die $!;
  join "", <$fh>;
};

cmpthese(100, {
  re2 => (#subname re2 =>
  sub {
    use re::engine::RE2;
    $foo =~ m{([a-zA-Z][a-zA-Z0-9]*)://([^ /]+)(/[^ ]*)?|([^ @]+)@([^ @]+)};
  }),
  re => (#subname re => 
  sub {
    $foo =~ m{([a-zA-Z][a-zA-Z0-9]*)://([^ /]+)(/[^ ]*)?|([^ @]+)@([^ @]+)};
  })
});

