Skip to content

Instantly share code, notes, and snippets.

@yko

yko/bench.pl Secret

Created January 11, 2011 14:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save yko/ab9e38849dc551a740dd to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use Benchmark ':all';
sub do_shift {
my $self = shift;
}
sub do_get {
my $self = $_[0];
}
sub do_set {
my ($self) = @_;
}
timethese(
10000000,
{ 'shift' => sub { do_shift('foo'); },
'$_[0]' => sub { do_get('foo'); },
'@_' => sub { do_set('foo'); },
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment