Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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

by marquezc329 (Scribe)
on Oct 04, 2012 at 23:16 UTC ( #997344=note: print w/ replies, xml ) Need Help??


in reply to Efficiency of map vs. more verbose basic/fundamental code

I can see why benchmarking such a simple expression is trivial. I suppose there are several lessons learned here.

  • Thanks to BrowserUk it is clear that in this particular situation the memory conservative:

    print "$_ : $h{ $_ }\n" for sort keys %h;

    is the best choice taking both efficiency and elegance into consideration.

  • I learned how to benchmark my subroutines which will hopefully be of service as I learn to write more complex code

  • And possibly most importantly I need to update my study materials!!!

Thanks again everybody!


Comment on Re: Efficiency of map vs. more verbose basic/fundamental code
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://997344]
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: (13)
As of 2015-07-30 17:28 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 (273 votes), past polls