
sub foo {}
sub with_goto { goto &foo };
sub with_call { foo(@_)   };

$N = shift || 100000;

my ($su, $ss) = times;
for (1 .. $N) { }
my ($eu, $es) = times;
my ($tu, $ts) = ($eu-$su, $es-$ss);
my $t = $tu+$ts;
print "null:                 u$tu s$ts t:$t\n";

my ($su, $ss) = times;
for (1 .. $N) { foo() }
my ($eu, $es) = times;
my ($tu, $ts) = ($eu-$su, $es-$ss);
my $t = $tu+$ts;
print "direct:               u$tu s$ts t:$t\n";

my ($su, $ss) = times;
for (1 .. $N) { with_call() }
my ($eu, $es) = times;
my ($tu, $ts) = ($eu-$su, $es-$ss);
my $t = $tu+$ts;
print "with_call:            u$tu s$ts t:$t\n";

my ($su, $ss) = times;
for (1 .. $N) { with_goto() }
my ($eu, $es) = times;
my ($tu, $ts) = ($eu-$su, $es-$ss);
my $t = $tu+$ts;
print "with_goto:            u$tu s$ts t:$t\n";

my ($su, $ss) = times;
for (1 .. $N) { with_call(1, 2) }
my ($eu, $es) = times;
my ($tu, $ts) = ($eu-$su, $es-$ss);
my $t = $tu+$ts;
print "with_call(1,2):       u$tu s$ts t:$t\n";

my ($su, $ss) = times;
for (1 .. $N) { with_goto(1, 2) }
my ($eu, $es) = times;
my ($tu, $ts) = ($eu-$su, $es-$ss);
my $t = $tu+$ts;
print "with_goto(1,2):       u$tu s$ts t:$t\n";

my ($su, $ss) = times;
for (1 .. $N) { with_call(1, 2, 3, 4, 5) }
my ($eu, $es) = times;
my ($tu, $ts) = ($eu-$su, $es-$ss);
my $t = $tu+$ts;
print "with_call(1,2,3,4,5): u$tu s$ts t:$t\n";

my ($su, $ss) = times;
for (1 .. $N) { with_goto(1, 2, 3, 4, 5) }
my ($eu, $es) = times;
my ($tu, $ts) = ($eu-$su, $es-$ss);
my $t = $tu+$ts;
print "with_goto(1,2,3,4,5): u$tu s$ts t:$t\n";



