Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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

by remiah (Hermit)
on Oct 05, 2012 at 01:38 UTC ( #997356=note: print w/ replies, xml ) Need Help??


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
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!).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://997356]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2014-07-12 03:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (238 votes), past polls