In case you are interested, here is the dummy function it is trying to run:use Benchmark; my $code = ''; print "Enter number of code runs:\n"; my $runs = <STDIN>; chomp ($runs); print "Inline or load up code(1|2)?\n"; my $inline = <STDIN>; chomp($inline); if($inline == 1) { $/ = "#END"; print "Enter code block (end with #END):\n"; $code = <STDIN>; chomp($code); print "\n...Testing...\n"; timethis($runs, $code); } else { my $file; my $func; print "Give me the file name: \n"; $file = <STDIN>; chomp($file); $code = `cat $file`; eval($code); die $@ if $@; if($code=~m/sub\s+(\w+)/) { $func = $1; } no strict 'refs'; print "\n...Testing...\n"; timethis($runs, &$func); }
When I run this with the code option I get the following:sub manic { my $x = 0; for (0..50) { $x++; } print $x; }
See? It just ran one time. If I manually type in the manic function's code it will run all 2000 times. What gives?:)~> perl bmark.pl Enter number of code runs: 2000 Inline or load up code(1|2)? 2 Give me the file name: test.al ...Testing... 51timethis 2000: 0 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU) (warning: too few iterations for a reliable count)
Celebrate Intellectual Diversity
In reply to Benchmark Runs Only Once by InfiniteSilence
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |