Created
June 21, 2011 03:58
-
-
Save avkhozov/1037210 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/env perl | |
use Benchmark qw(:all); | |
sub with_return { | |
my ($x, $y) = @_; | |
return $x, $y; | |
} | |
sub without_return { | |
my ($x, $y) = @_; | |
($x, $y); | |
} | |
cmpthese( | |
10_000_000, | |
{ 'with return' => \&with_return, | |
'without return' => \&without_return, | |
} | |
); | |
__END__ | |
C:\Users\avkhozov>perl ret.t | |
Rate with return without return | |
with return 3885004/s -- -1% | |
without return 3909304/s 1% -- | |
C:\Users\avkhozov>perl -v | |
This is perl 5, version 12, subversion 3 (v5.12.3) built for MSWin32-x86-multi-thread |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment