in reply to inline caching a list-generating sub

I'm curious what advantage this method provides over Memoize. Perhaps a link to HOP?? I don't know what that is and i wonder if it might answer my question.


___________
Eric Hodges
  • Comment on Re: inline caching a list-generating sub

Replies are listed 'Best First'.
Re^2: inline caching a list-generating sub
by ysth (Canon) on Aug 19, 2005 at 18:04 UTC
    Sorry, Higher Order Perl is a book on functional programming in perl, by SchwernDominus, the author of the Memoize module.

    In my experimentation, Memoize has shown quite high overhead. A general solution like that has to impose the cost of a separate sub call, as well as handling all sorts of parameters (e.g. differentiating between undef and "") and caching separately for scalar/list/void context.

    In most cases I've run into, the simple inline scalar caching is sufficient and not too burdensome to insert. Throwing list context into the mix complicates things a lot.

    Update: I really do know the difference between Schwern and Dominus, no idea what bizarre neural connection led me to get that wrong.

Re^2: inline caching a list-generating sub
by etm117 (Pilgrim) on Aug 19, 2005 at 16:36 UTC
    HOP => Higher Order Perl

    It is a great book about how to do 'more' with Perl, especially things like closures & iteration. (And probably more, but I am only ~one-third of the way through the book)

    Hope that helps.