http://qs321.pair.com?node_id=997356


in reply to Re^4: Efficiency of map vs. more verbose basic/fundamental code
in thread Efficiency of map vs. more verbose basic/fundamental code

"Rate" column shows how many times it could process in one second. Verbose2 is the fastest.

"This chart is sorted from slowest to fastest ..."
see http://search.cpan.org/~rjbs/perl-5.16.1/lib/Benchmark.pm.

How about think of map in conjunction with lisp? Sometimes I see lisp conscious scripts at this perlmonk. For example moritz's max tree depth in this thread, or like this one, recently posted. And several times I saw the name of book 'High Order Perl', which I have not yet read...

regards.

  • Comment on Re^5: Efficiency of map vs. more verbose basic/fundamental code

Replies are listed 'Best First'.
Re^6: Efficiency of map vs. more verbose basic/fundamental code
by ruzam (Curate) on Oct 05, 2012 at 14:28 UTC

    Thanks for that catch remiah. ++

    I switched the benchmark methods from 'timethese' to 'cmpthese' at the same time that I fixed the test function calls, and then simply had a brain fart when I looked at the results. I've edited my post accordingly.

    Using foreach is faster than map in this example. My faith is restored (whew!).