laziness, impatience, and hubris | |
PerlMonks |
Re: Building a small perlby Animator (Hermit) |
on Mar 20, 2009 at 17:55 UTC ( [id://752125]=note: print w/replies, xml ) | Need Help?? |
First: how much memory does the program use when you just run a syntax check? Or when add a exit; as the very first line of the script? (well the second after a sleep) Is it the compiled program that is using the memory or is it the code that is being executed at runtime that is using a lot of memory? What you should be doing (IMHO) is figure out what is using the memory. One approach could be to add a system("ps -uh $$"); after every line. IMHO you will not get a serious memory reduction by recompiling perl and setting/unsetting some options. The only way to reduce the memory is to look at the code of the application. One example to show what I mean: vs
The array contains exactly the same information. The first program uses 64MB of memory and the second 22MB of memory. The first one uses more memory, the second one uses more CPU. Same example but with a syntax check: vs
What this shows is that in the first program 45MB of memory is already being used before the code is being executed. That memory will only be free'ed/reused when perl stops. update: To provider an anwsers on your question about: 'oplines - make perl runtime 8% faster and smaller' that messages is theoretical and you such read it as such. It certainly will not make the runtime of each and every application 8% faster and smaller. It all depends on where the memory is being used.
In Section
Seekers of Perl Wisdom
|
|