Help for this page

Select Code to Download


  1. or download this
    List Generation
    
    Use map instead of for when generating new lists from old.
    
  2. or download this
    use strict;
    use warnings;
    ...
    sub test_map {
        my @sqrt_results = map { sqrt $_ } @results;
    }
    
  3. or download this
    $count=-1
    (warning: too few iterations for a reliable count)
    ...
          Rate for map
    for 2.73/s  -- -8%
    map 2.95/s  8%  --
    
  4. or download this
    $count=-1
    
    ...
    Benchmark: running for, map for at least 10 CPU seconds...
           for: 10 wallclock secs (10.11 usr +  0.00 sys = 10.11 CPU) @  3
    +.46/s (n=35)
           map: 10 wallclock secs (10.03 usr +  0.00 sys = 10.03 CPU) @  3
    +.29/s (n=33)