Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
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
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!).

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 drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2015-07-07 23:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls