in reply to Inefficient code in Camel book?

Without being too vague, speed often comes at the expense of memory.

UPDATE: Consider Memoize.

--
perl -pe "s/\b;([st])/'\1/mg"

Replies are listed 'Best First'.
Re: Re: Page 18 of the Camel
by cmilfo (Hermit) on Jan 22, 2002 at 12:47 UTC
    Yes, speed comes at the expense of memory. And yes again, I could use Memoize to solve the memory problems.

    Maybe my question is better asked as, "what is different about how the array is stored versus how the implicit split is stored that causes memory usage to increase?"

    It's the same amount of data, how does the storage differ?
      I wasn't saying use Memoize at all. Consider it simply meant look at is an example of the trade-off between cycles and bytes.

      Trying the original form with a scoped @grades might also be interesting.

      --
      perl -pe "s/\b;([st])/'\1/mg"