Next Making Programs Faster 29

Simple Benchmarker

              substr  5.04  0.01   5.05
               regex  5.71  0.00   5.71
      my ($su, $ss) = times;
      for (1 .. $N) { }
      my ($eu, $es) = times;
      my ($tu, $ts) = ($eu - $su, $es - $ss);
      my $total = $tu + $ts;
      printf "%20s %5.2f %5.2f %6.2f\n", "NULL", $tu, $ts, $total;
                NULL  1.24  0.00   1.24
              substr  5.10  0.01   5.11
               regex  5.69  0.00   5.69


Next Copyright © 2003 M. J. Dominus