HTTP-XSCookies

 view release on metacpan or  search on metacpan

tools/bench.pl  view on Meta::CPAN

            run_benchmark($name, $cookies{$name});
        }
    }

    return 0;
}

sub run_benchmark {
    my ($name, $cookie) = @_;

    my $iterations = 1e5;
    my $bench = Dumbbench->new(
        target_rel_precision => 0.005,
        initial_runs         => 20,
    );

    $bench->add_instances(
        # Dumbbench::Instance::PerlSub->new(
        #     name => get_name('Cookie::Baker', $name),
        #     code => sub {
        #         for(1..$iterations){
        #             Cookie::Baker::crush_cookie($cookie);
        #         }
        #     },
        # ),

        Dumbbench::Instance::PerlSub->new(
            name => get_name('Cookie::Baker::XS', $name),
            code => sub {
                for(1..$iterations){
                    Cookie::Baker::XS::crush_cookie($cookie);
                }
            },
        ),

        Dumbbench::Instance::PerlSub->new(
            name => get_name('HTTP::XSCookies', $name),
            code => sub {
                for(1..$iterations){
                    HTTP::XSCookies::crush_cookie($cookie);
                }
            },
        ),
    );

    $bench->run;
    $bench->report;
}



( run in 0.453 second using v1.01-cache-2.11-cpan-71847e10f99 )