Created
September 9, 2009 09:41
-
-
Save kentfredric/183614 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use MooseX::Declare; | |
use lib '.'; | |
use TestCase; | |
my $tc = TestCase->new(); | |
$tc->example; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use MooseX::Declare; | |
use lib '.'; | |
use TestCase2; | |
my $tc = TestCase2->new(); | |
$tc->example; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
make coverage | |
$WEBBROWSER cover_db/TestCase-pm.html | |
make profile | |
$WEBBROWSER nytprof/index.html | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
coverage: | |
perl -MDevel::Cover -I. e.t | |
cover --summary | |
profile: | |
perl -d:NYTProf -I. e.t | |
nytprofhtml | |
clean-coverage: | |
rm -fr cover_db | |
clean-profile: | |
rm -fr nytprof.out | |
rm -fr nytprof | |
clean: clean-profile clean-coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use MooseX::Declare; | |
class TestCase { | |
method example { | |
# Quick Fibonacci impl. | |
my @list = ( 1 , 1 ); | |
for ( 1 .. 1000 ){ | |
push @list, $list[-1] + $list[-2]; | |
} | |
} | |
method example_b { | |
# Quick Fibonacci impl. | |
my @list = ( 1 , 1 ); | |
for ( 1 .. 1000 ){ | |
push @list, $list[-1] + $list[-2]; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use MooseX::Declare; | |
class TestCase2 { | |
use Benchmark; | |
method example { | |
# Quick Fibonacci impl. | |
my @list = ( 1 , 1 ); | |
my @blist = (); | |
timethis(-2,sub { | |
for ( 1 .. 1000 ){ | |
push @list, $list[-1] + $list[-2]; | |
} | |
for ( 0.. $#list - 1 ){ | |
push @blist, $list[$_]/$list[$_+1]; | |
}}); | |
} | |
method example_b { | |
# Quick Fibonacci impl. | |
my @list = ( 1 , 1 ); | |
for ( 1 .. 1000 ){ | |
push @list, $list[-1] + $list[-2]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment