develooper Front page | perl.perl5.porters | Postings from January 2005

(PATCH: Benchmark.pm, Benchmark.t) RE: IMPLICIT_SYS and Perl_Malloc behaviour under Win32 (out of me mory with Perls malloc?)

Thread Previous | Thread Next
From:
Orton, Yves
Date:
January 7, 2005 11:36
Subject:
(PATCH: Benchmark.pm, Benchmark.t) RE: IMPLICIT_SYS and Perl_Malloc behaviour under Win32 (out of me mory with Perls malloc?)
Message ID:
E471ED2DFD9353458E8B75FD6D6B0307B6392D@defra1ex4.de.mcilink.com
--- perl-5.8.6\lib\Benchmark.pm	2005-01-07 20:01:37.915000000 +0100
+++ perl-5.8.6-virgin-orig\lib\Benchmark.pm	2004-02-23 19:50:28.000000000 +0100
@@ -609,19 +609,13 @@
 
 # --- Functions implementing low-level support for timing loops
 
-my $MAX_N=((~0-1)/2-1);
-
 $_Usage{runloop} = <<'USAGE';
 usage: runloop($number, [$string | $coderef])
 USAGE
 
 sub runloop {
     my($n, $c) = @_;
-    if ($n>$MAX_N) {
-      carp "Timing iterations exceeds range operators tolerance.\n".
-           "Reducing  from $n to ".($MAX_N)."\n";
-      $n=$MAX_N;
-    }
+
     $n+=0; # force numeric now, so garbage won't creep into the eval
     croak "negative loopcount $n" if $n<0;
     confess usage unless defined $c;
--- perl-5.8.6\lib\Benchmark.t	2005-01-07 20:08:46.915000000 +0100
+++ perl-5.8.6-virgin-orig\lib\Benchmark.t	2003-08-07 22:26:48.000000000 +0200
@@ -383,7 +383,7 @@
 {
     select(OUT);
     my $start = times;
-    my $chart = cmpthese( -0.1, { a => "fib(3)", b => "fib(5)" } , "auto") ;
+    my $chart = cmpthese( -0.1, { a => "++\$i", b => "\$i = sqrt(\$i++)" }, "auto" ) ;
     my $end = times;
     select(STDOUT);
     ok (($end - $start) > 0.05, "benchmarked code ran for over 0.05 seconds");
@@ -405,7 +405,7 @@
 {
     select(OUT);
     my $start = times;
-    my $chart = cmpthese( -0.1, { a => "fib(3)", b => "fib(5)" } ) ;
+    my $chart = cmpthese( -0.1, { a => "++\$i", b => "\$i = sqrt(\$i++)" } ) ;
     my $end = times;
     select(STDOUT);
     ok (($end - $start) > 0.05, "benchmarked code ran for over 0.05 seconds");
@@ -502,6 +502,7 @@
 isa_ok(timeit(5, '++$bar'), 'Benchmark', "timeit eval");
 is ($bar, 5, "benchmarked code was run 5 times");
 is ($debug->read(), '', "There was no debug output");
+
 Benchmark->debug(1);
 
 $bar = 0;

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About