in reply to Re: Complex Hash
in thread Complex Hash

That would work well if GetEMailFor() was being called lots of times with the same query, but it isn't. Its being called several times with almost every query being different.

Replies are listed 'Best First'.
RE: RE: Re: Complex Hash
by merlyn (Sage) on Sep 06, 2000 at 04:25 UTC
    Please relook. I'm memoizing the underlying individual items. Not the combination of what's being called to GetEMailFor.
    "Please read for comprehension!" -- PurlGurl {grin}

    -- Randal L. Schwartz, Perl hacker

      Yes, but the combination is not what matters. Its almost a red herring. In fact, I'm not even using that ability (yet), I merely provided for it in case I needed it. (and if I find that I don't I will probably take it out.)

      What is bothering me is that I have to check every key until I find the match, starting from some arbitrary point. (Arbitrary to me, not Perl) I lose the true advantage of an associative array... the hashing algorithm.

      By the way, your quote:
      "Please read for comprehension!" -- PurlGurl {grin}
      Implies that I didn't comprehend your suggestion. I am offended at your arrogance.

        Did you read my code? I already turned your second-level linear search into a simple hash lookup. From a O(N*M) operation to a O(N) operation for N categories, M names per category. And then, I'm memoizing that, so it's speed up on any subsequent hits!

        -- Randal L. Schwartz, Perl hacker


        P.S. As for your P.S., you didn't read my code, so my statement is all the more accurate!