public
Created

  • Download Gist
gistfile1.sh
Shell
1 2 3 4 5 6 7 8 9
# SORTED FROM SLOWEST TO FASTEST
 
# Params::Validate
$ perl -MParams::Validate=:all -MBench -e'%spec = (a=>{type=>SCALAR, regex=>qr/^\d+$/, callbacks=>{"min 1"=>sub{shift() >= 1}}, default=>1}); @ary = (a=>1); bench sub { validate(@ary, \%spec) }, -2'
333331 calls (155860/s), 2.139s (0.0064ms/call)
 
# Data::Sah
$ perl -MBench -MData::Sah=gen_validator -e'$v=gen_validator(["hash*"=>keys=>{a=>["int*", min=>1]}], {return_type=>"str"}); bench sub { $v->({a=>1}) }, -2'
411762 calls (183012/s), 2.250s (0.0055ms/call)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.