Next Making Programs Faster 161

Mail Folder Analyzer Revisited

     %Time ExclSec CumulS #Calls sec/call Csec/c  Name
      63.7   0.830  0.829    109   0.0076 0.0076  main::letter_histogram
      13.8   0.180  0.180      1   0.1800 0.1800  Mail::Util::read_mbox

     sub letter_histogram {
       my $strdex = (length $_[0])-1;
       $letter_hist{substr($_[0],$_,1)}++     for (0..$strdex);
     }
     sub letter_histogram {
       $letter_hist{$_}++     for split //, $_[0];
     }
     Before                    After           
     real    0m2.739s          real    0m5.379s
     user    0m1.270s          user    0m2.410s
     sys     0m0.040s          sys     0m0.040s

Next Copyright © 2003 M. J. Dominus