On Thu, Jun 26, 2008 at 2:50 PM, James Keenan via RT <[EMAIL PROTECTED]> wrote: > On #parrot I had some discussion about tools/build/pmc2c.pl with bacek > and DietCoke. I pasted some output from dprofpp: > > http://nopaste.snit.ch/13401 > http://nopaste.snit.ch/13402 > > On the basis of these pastes, I was advised to consider using Memoize.pm > to memoize the most frequently called functions in the modules > underlying pmc2c.pl. > > However, my preliminary investigation suggests that Memoize is not a > good bet here. As I understand Memoize, it is useful in circumstances > where you have to have to call a function repeatedly and where there's a > high probability that you will call it with the same arguments more than > once. Memoize caches the return value associated with a particular set > of arguments. But Memoize will only be worth the effort if the time you > save by doing cache lookups rather than function calls is greater than > the time needed to load Memoize.pm and memoize the function in the first > place. > > But the functions in the modules underlying pmc2c.pl are not this sort > of functions. They tend to be OO methods that change the internal state > of the object. They tend not to have meaningful return values (i.e., > return values other than truth, falseness, undef, etc.)
In that case, Memoize will not help, you're absolutely right. (Might be worth seeing if the code is amenable to a refactor that -would- be amenable to this, but that's probably more work.) > So my hunch is that Memoize is not likely to be useful here -- but I > would welcome any cases to the contrary that anyone might cite. > > Thank you very much. > kid51 > > -- Will "Coke" Coleda