The test suite for MooX::Pression used to run in 79 seconds on my laptop. Now it's at 10 seconds.

And no, I didn't cut out any tests — I switched from using Keyword::Declare to a combination of Keyword::Simple and PPR. (Keyword::Declare is a wrapper around Keyword::Simple and PPR, but I found out by using them directly, I could massively improve compile-time speed.)

MooX::Pression allows you to build classes and roles with multimethods, types, method signatures, and sweet, sweet, sugary syntax…

usev5.18;
usestrict;
usewarnings;

my$json=MyApp->new_json_encoder;

say$json->stringify({
   foo =>123,
   bar =>[1,2,3],
   baz =>\1,
   quux=>{xyzzy=>666},
});

packageMyApp{
   useMooX::Pression;
   
   classJSON::Encoder{
      multimethodstringify(Undef$value){
         'null';
      }
      
      multimethodstringify(ScalarRef[Bool]$value){
         $$value?'true':'false';
      }
      
      multimethodstringify(Num$value){
         $value;
      }
      
      multimethodstringify:alias(quote_str)(Str$value) {
         sprintf(q<"%s">,quotemeta$value);
      }
      
      multimethodstringify(ArrayRef$arr){
         sprintf(
            q<[%s]>,
            join(q<,>,map($self->stringify($_),@$arr))
         );
      }
      
      multimethodstringify(HashRef$hash){
         sprintf(
            q<{%s}>,
            join(
               q<,>,
               mapsprintf(
                  q<%s:%s>,
                  $self->quote_str($_),
                  $self->stringify($hash->{$_}),
               ),sortkeys%$hash
            ),
         );
      }
   }
}