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

Re: Re: Adventures in optimization (or: the good and bad side of being truly bored)

by diotalevi (Canon)
on Aug 02, 2003 at 16:25 UTC ( #280299=note: print w/replies, xml ) Need Help??


in reply to Re: Adventures in optimization (or: the good and bad side of being truly bored)
in thread Adventures in optimization (or: the good and bad side of being truly bored)

And to add caching - Memoize!

As for actual profiling, its really easy to run your scripts under Devel::DProf (which comes with perl don'cha know) `perl5 -d:DProf test.pl` and after its finished, dprofpp. Sooper easy. I worked out an order of magnitude increase in some perl code speed by repeatedly testing my changes and assumptions against profiled code. And for those that are curious - it turns out that regex capturing can be a real dog some times.

  • Comment on Re: Re: Adventures in optimization (or: the good and bad side of being truly bored)

Replies are listed 'Best First'.
Re: Re: Re: Adventures in optimization (or: the good and bad side of being truly bored)
by Limbic~Region (Chancellor) on Aug 02, 2003 at 16:29 UTC
    diotalevi,
    Your attention to detail never ceases to amaze me. I didn't want to mention Memoize at the beginning since it would not work for what revdiablo was trying to do, but I did want to mention it later as a "generally you can add caching simply by using Memoize by Dominus" and completely forgot.

    Thanks - L~R

Re: Re: Re: Adventures in optimization (or: the good and bad side of being truly bored)
by revdiablo (Prior) on Aug 02, 2003 at 19:54 UTC

    Indeed. Devel::DProf is good stuff. I was very happy with my results when using it and Benchmark to, erm, profile and benchmark my code.

    As for Memoize, Limbic~Region's reply is correct. It won't really work for me in this case, because I willshould never have the case where my subroutine gets called twice with the same arguments (unless of course there's something wrong in my log and I get duplicate entries). Thanks for mentioning this though, I've been meaning to look at it for a good while now.

      I just mentioned Memoize for the general case and the rest of our audience.

Re: Re: Re: Adventures in optimization (or: the good and bad side of being truly bored)
by demerphq (Chancellor) on Aug 04, 2003 at 06:51 UTC

    Regarding Memoize, maybe im weird but i've never found it to be particularly useful. I have never had a real (dev and toy, ok) circumstance where I can cache based on arguments alone, and splitting my function into subfuctions that can be so Memoized never seemed to me to be the right thing to do. I think caching properly requires some degree of thought and understanding of the overall process, which combined with the ease of establishing a cache in Perl I have never used Memoize in any production code.


    ---
    demerphq

    <Elian> And I do take a kind of perverse pleasure in having an OO assembly language...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2019-12-16 10:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?