Next Making Programs Faster 162

letter_histogram

     sub letter_histogram {
       my $strdex = (length $_[0])-1;
       $letter_hist{substr($_[0],$_,1)}++     for (0..$strdex);
     }
     sub letter_histogram {
       my $msg = shift;
       my $strdex = (length $msg)-1;
       $letter_hist{substr($msg,$_,1)}++     for (0..$strdex);
     }
     Before                     After           
     real    0m1.277s           real    0m1.236s
     user    0m1.250s           user    0m1.220s
     sys     0m0.020s           sys     0m0.010s

Next Copyright © 2003 M. J. Dominus