Skip to content

Instantly share code, notes, and snippets.

@yko
Created January 12, 2011 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yko/4c6b4e6f390a70bc3130 to your computer and use it in GitHub Desktop.
Save yko/4c6b4e6f390a70bc3130 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use Benchmark ':all';
sub do_package {
my $self = $_[0];
my $param = $_[1];
}
sub do_caller {
my $self = caller;
my $param = $_[0];
}
@_ = ('foo');
timethese(
10000000,
{ 'package' => sub { __PACKAGE__->do_package(1); },
'caller' => sub { do_caller(1); },
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment