Skip to content

Instantly share code, notes, and snippets.

@tobyink
Created July 21, 2014 08:40
Show Gist options
  • Save tobyink/dfdf9bb826a530781e3d to your computer and use it in GitHub Desktop.
Save tobyink/dfdf9bb826a530781e3d to your computer and use it in GitHub Desktop.
use strictures;
use Types::Standard -types;
use Benchmark qw(timethis);
{
my $check = Enum[qw/ foo bar baz /];
my $data = "bar";
my $sub = $check->compiled_check;
warn($check->inline_check(q/$str/));
$sub->($data) or die;
timethis 500_000, sub { $sub->($data) };
}
__END__
initial speed: 232558.14/s
with xs speed: 1020408.16/s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment