[San-Diego-pm] module idea

Daniel Risse dan at tierra.net
Fri Oct 6 13:43:05 PDT 2006

Oops... I had ran my tests to measure memory usage a few months ago and 
didn't recall them correctly.  I was off in my recollection.

This is a snippet from Practical Mod Perl page 474 which does show 
actual results.

Example 13-13 cgi_oo.pl
use CGI ()
my $q = CGI->new;
print $q->header();
print $q->b("Hello");

Example 13-14 cgi_proc.pl
use CGI qw(header b);
print header();
print b("Hello");

And then the memory usage is listed as 1966 bytes for 13-13 and 4710 for 
13-14.  This would seem to indicate it is a bit less than 2 KB per symbol.

So this module would likely only be important for mod_perl sites, or 
large projects.  With mod_perl, the symbols will likely be exported into 
several different scripts.  And also take up memory for all of the 
mod_perl processes that are running.

It seems like it will often save a bit of memory, and sometimes save a 
great deal of memory.  If this can be done without having to alter the 
existing code other than importing another module, it seems like there 
would be little reason not to use it.

Douglas Wilson wrote:
> Daniel Risse wrote:
>> unnecessary memory.  My tests showed about 100k for each symbol imported.
> 100k? (you mean 100KB?)
> Something is very wrong. I can't believe it takes that much for one
> symbol. Or do you mean importing one symbol into many packages? And
> how many imports would it take to add up to 100K?
> Perhaps you're counting the memory required by Exporter?
> That module will probably be required anyway by some dependency
> of many non-trivial programs.
> -Doug
> _______________________________________________
> San-Diego-pm mailing list
> San-Diego-pm at pm.org
> http://mail.pm.org/mailman/listinfo/san-diego-pm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/san-diego-pm/attachments/20061006/f2b45585/attachment.html 

More information about the San-Diego-pm mailing list