[Israel.pm] Article: Optimizing Perl

Yuval Yaari yuval at windax.com
Thu Oct 28 04:14:25 PDT 2004

Shlomo Yona wrote:

> And what about the '.' vs. ','?

I can't think of a good reason for a difference between the two, 
I'd be more than glad to hear if such exists, and especially why...

> Here's the easy answer: buy more memory (no kidding!).

As if I haven't thought of it myself. :)
How do you store data-structures that are bigger than your RAM (yes, 
even after I bought more of it)?
Sometimes you can't buy enough RAM for tasks (10GB data-structures...).
I think the bioperl guys handle such data-structures, don't they? So 
there should be a good solution...

> There are some real life cases when optimizing code is
> simply too expensive (in terms of time you spend on it), and
> the simpler, easier and cheaper way to solve the memory
> problem is getting enough RAM to do the job.

What if the data-structure is bigger than the amount of RAM you could 
buy in a reasonable price, like 100GB data-structures? :)

> Having said that, I'll also address your request. The key
> for solving such problems is understanding why and when your
> operating system swaps, and then see what you can do (if you
> can) in order to fit your data access patterns to ones that
> play well with the swapping policies. This is usually a
> complicated game to play...

I guess that's way beyond the scope of your lecture.
You might want to mention weakening circular-references in order to make 
perl (>=5.6) garbage collect them, I heard some people have had problems 
with those.

BTW: how do I check the actual memory size that my data-structure takes?


More information about the Perl mailing list