alnewkirk/Bubblegum — pull request #1 by tobyink (2014-02-13 14:25:17+00:00)
Title: Much faster implementations of most of the functions in Bubblegum::Constraint.

The `asa_*` functions in Bubblegum::Constraint are not especially efficient usage of Types::Standard and Type::Params. This pull request speeds them up by about 100 times. I also include a benchmarking script below for verification:

```perl
use v5.10;
use strict;
use warnings;
use Benchmark qw(cmpthese);

use Type::Params;
use Types::Standard;

# Old version
sub asa_arrayref1 {
my $arrayref = shift;
my $constraint = Types::Standard::ArrayRef;
Type::Params::compile($constraint)->($arrayref);
return $arrayref;
}

# New version
*asa_arrayref2 = \&Types::Standard::assert_ArrayRef;

cmpthese -3, {
old => q[ asa_arrayref1([]) ],
new => q[ asa_arrayref2([]) ],
};

__END__
Rate old new
old 888/s -- -99%
new 96208/s 10736% --
```