Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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

by remiah (Hermit)
on Oct 05, 2012 at 01:38 UTC ( [id://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.

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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://997356]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-03-28 23:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found