Class-Std-Fast

 view release on metacpan or  search on metacpan

benchmark/class-std.pl  view on Meta::CPAN

1;


package main;
print "Info:
Each test creates an object an stacks two objects into it (two levels)\n";

for my $class ('MyBenchTestFastCache', 'MyBenchTestFastBasic') {
    #, 'MyBenchTestFast', 'MyBenchTest') {
    my $n = 100000;
    print "\n$class ($n iterations - first run)\n";
    timethis $n, sub {
        push @list,  $class->new();
        $list[-1]->set_one($class->new());
        $list[-1]->get_one()->set_two($class->new());
        $list[-1]->get_one();
    };
    print "Cleanup: Destroying ${ \($n *3) } objects\n";
    timethis 1, sub { undef @list };
    print "\n$class ($n iterations - second run)\n";
    timethis $n , sub {
        push @list,  $class->new();
        $list[-1]->set_one($class->new());
        $list[-1]->get_one()->set_two($class->new());
        $list[-1]->get_one();
    };
    print "Cleanup: Destroying ${ \($n *3) } objects\n";
    timethis 1, sub { undef @list };
}

benchmark/class-std.txt  view on Meta::CPAN

    /usr/share/perl5
    /usr/lib/perl/5.8
    /usr/share/perl/5.8
    /usr/local/lib/site_perl
    .


Info:
Each test creates an object an stacks two objects into it (two levels)

MyBenchTestFastCache (50000 iterations - first run)
timethis 50000:  1 wallclock secs ( 0.91 usr +  0.02 sys =  0.93 CPU) @ 53763.44/s (n=50000)
Cleanup: Destroying 150000 objects
timethis 1:  2 wallclock secs ( 1.58 usr +  0.01 sys =  1.59 CPU) @  0.63/s (n=1)
            (warning: too few iterations for a reliable count)

MyBenchTestFastCache (50000 iterations - second run)
timethis 50000:  0 wallclock secs ( 0.45 usr +  0.00 sys =  0.45 CPU) @ 111111.11/s (n=50000)
Cleanup: Destroying 150000 objects
timethis 1:  2 wallclock secs ( 1.54 usr +  0.01 sys =  1.55 CPU) @  0.65/s (n=1)
            (warning: too few iterations for a reliable count)

MyBenchTestFastBasic (50000 iterations - first run)
timethis 50000:  1 wallclock secs ( 0.57 usr +  0.01 sys =  0.58 CPU) @ 86206.90/s (n=50000)
Cleanup: Destroying 150000 objects
timethis 1:  1 wallclock secs ( 1.39 usr +  0.00 sys =  1.39 CPU) @  0.72/s (n=1)
            (warning: too few iterations for a reliable count)

MyBenchTestFastBasic (50000 iterations - second run)
timethis 50000:  1 wallclock secs ( 0.55 usr +  0.00 sys =  0.55 CPU) @ 90909.09/s (n=50000)
Cleanup: Destroying 150000 objects
timethis 1:  1 wallclock secs ( 1.38 usr +  0.01 sys =  1.39 CPU) @  0.72/s (n=1)
            (warning: too few iterations for a reliable count)

MyBenchTestFast (50000 iterations - first run)
timethis 50000: 14 wallclock secs (13.10 usr +  0.08 sys = 13.18 CPU) @ 3793.63/s (n=50000)
Cleanup: Destroying 150000 objects
timethis 1:  1 wallclock secs ( 1.51 usr +  0.03 sys =  1.54 CPU) @  0.65/s (n=1)
            (warning: too few iterations for a reliable count)

MyBenchTestFast (50000 iterations - second run)
timethis 50000: 14 wallclock secs (12.93 usr +  0.08 sys = 13.01 CPU) @ 3843.20/s (n=50000)
Cleanup: Destroying 150000 objects
timethis 1:  1 wallclock secs ( 1.52 usr +  0.00 sys =  1.52 CPU) @  0.66/s (n=1)
            (warning: too few iterations for a reliable count)

MyBenchTest (50000 iterations - first run)
timethis 50000: 14 wallclock secs (13.48 usr +  0.08 sys = 13.56 CPU) @ 3687.32/s (n=50000)
Cleanup: Destroying 150000 objects
timethis 1:  2 wallclock secs ( 1.71 usr +  0.02 sys =  1.73 CPU) @  0.58/s (n=1)
            (warning: too few iterations for a reliable count)

MyBenchTest (50000 iterations - second run)
timethis 50000: 14 wallclock secs (13.27 usr +  0.09 sys = 13.36 CPU) @ 3742.51/s (n=50000)
Cleanup: Destroying 150000 objects
timethis 1:  2 wallclock secs ( 1.71 usr +  0.02 sys =  1.73 CPU) @  0.58/s (n=1)
            (warning: too few iterations for a reliable count)



( run in 1.936 second using v1.01-cache-2.11-cpan-96521ef73a4 )