On Sun, Jun 26, 2005 at 01:58:26PM +0200, Tels wrote: > (Including vars, because that gives us strict, vars, and warnings as a > baseline): > > # ./perl -Ilib -Mvars -le 'print join ("\n", sort keys %INC); sleep (100)' > strict.pm > vars.pm > warnings.pm > warnings/register.pm
Carp doesn't use any of this. Just Exporter. $ perl -MExporter -MCarp -wle 'END { print join "\n", keys %INC }' Carp.pm Exporter.pm The only module Carp uses is Exporter. You didn't include Exporter in your baseline so what you're really testing is the cost of Carp + Exporter vs strict + vars + warnings + warnings::register. ie. nonsense. What you need to check is: No modules (its important to retain all the testing code that will be used later, it costs memory). $ perl -wle 'print join "\n", keys %INC; sleep 100;' & schwern 12654 0.0 2.0 3776 1256 pts/0 S Jun21 0:00 perl -wle print join "\n", keys %INC; sleep 100; Exporter. $ perl -MExporter -wle 'print join "\n", keys %INC; sleep 100' & Exporter.pm schwern 12618 0.0 2.4 3916 1460 pts/0 S Jun21 0:00 perl -MExporter -wle print join "\n", keys %INC; sleep 100 Carp. $ perl -MCarp -wle 'print join "\n", keys %INC; sleep 100' & Carp.pm Exporter.pm schwern 12626 0.0 2.5 3916 1516 pts/0 S Jun21 0:00 perl -MCarp -wle print join "\n", keys %INC; sleep 100 Carp + Carp::Heavy. $ perl -MCarp -MCarp::Heavy -wle 'print join "\n", keys %INC; sleep 100' & warnings.pm Carp.pm Carp/Heavy.pm strict.pm Exporter.pm schwern 12629 0.0 2.8 4048 1724 pts/0 S Jun21 0:00 perl -MCarp -MCarp::Heavy -wle print join "\n", keys %INC; sleep 100 I never was any good at interpreting ps output but it looks like loading Carp on top of Exporter adds a grand total of 56K on my Debian box (5.8.4). Carp::Heavy slugs in 208K plus another 132K of virtual memory. Exporter weighs in at 204K + 140K virtual. I'd take the Exporter numbers with a grain of salt, its a very small module. No where near the size of Carp::Heavy and shouldn't cost that much memory. The above might be measuring some sort of first module loaded cost. Have a look at loading strict vs strict + Exporter. schwern 12659 0.0 2.2 3784 1376 pts/0 S Jun21 0:00 perl -Mstrict -wle print join "\n", keys %INC; sleep 100; schwern 12662 0.0 2.4 3916 1492 pts/0 S Jun21 0:00 perl -MExporter -Mstrict -wle print join "\n", keys %INC; sleep 100; strict costs 120K + 8K vm. strict + Exporter is 236K + 140K vm. Note that if we add the cost of strict alone with the cost of Exporter alone the numbers don't jive with loading both of them together. It should cost 324K + 148K vm, but it actually costs nearly 100K less. So checking the cost of loading a module by subtracting the cost of loading all its dependencies from the cost of loading the module might not be accurate. -- Michael G Schwern [EMAIL PROTECTED] http://www.pobox.com/~schwern Don't try the paranormal until you know what's normal. -- "Lords and Ladies" by Terry Prachett