New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Benchmark calls coderef with spurious arguments #7578
Comments
From siegel@zrz.tu-berlin.deThis is a bug report for perl from anno4000@lublin.zrz.tu-berlin.de, Benchmark::runloop calls a benchmarked coderef with two spurious The fix below (against 1.06 from Perl 5.8.5) changes the call to $subref Note: perlbug was run on a different machine from the one where the Regards, Anno Inline Patch--- orig/lib/Benchmark.pm Mon Feb 23 19:50:27 2004
+++ perl-5.8.5/lib/Benchmark.pm Thu Nov 4 20:21:07 2004
@@ -648,7 +648,7 @@
# &runloop a lot, and thus reduce additive errors.
my $tbase = Benchmark->new(0)->[1];
while ( ( $t0 = Benchmark->new(0) )->[1] == $tbase ) {} ;
- &$subref;
+ $subref->();
$t1 = Benchmark->new($n);
$td = &timediff($t1, $t0);
timedebug("runloop:",$td);
--- orig/lib/Benchmark.t Thu Aug 7 21:26:47 2003
+++ perl-5.8.5/lib/Benchmark.t Thu Nov 4 20:40:19 2004
@@ -8,7 +8,7 @@
use warnings;
use strict;
use vars qw($foo $bar $baz $ballast);
-use Test::More tests => 193;
+use Test::More tests => 194;
use Benchmark qw(:all);
@@ -41,6 +41,11 @@
isa_ok(timeit(5, '++$bar'), 'Benchmark', "timeit eval");
is ($bar, 5, "benchmarked code was run 5 times");
+
+# is coderef called with spurious arguments?
+timeit( 1, sub { $foo = @_ });
+is ($foo, 0, "benchmarked code called without arguments");
+
print "# Burning CPU to benchmark things will take time...\n";
---
Site configuration information for perl v5.8.1: Configured by anno4000 at Wed Oct 1 12:15:29 MEST 2003. Summary of my perl5 (revision 5.0 version 8 subversion 1) configuration: Locally applied patches: @INC for perl v5.8.1: Environment for perl v5.8.1: |
From @rgsAnno Siegel (via RT) wrote:
Thanks, applied to bleadperl, bumping $Benchmark::VERSION to 1.07, |
The RT System itself - Status changed from 'new' to 'open' |
@rgs - Status changed from 'new' to 'resolved' |
Migrated from rt.perl.org#32327 (status was 'resolved')
Searchable as RT32327$
The text was updated successfully, but these errors were encountered: