B
Bigus
Hi
I have a load of scripts that use various different cpan modules and I
thought to tidy up the header of each script I'd try bundling all the "use
..." commands into one init file in my modules folder. So in each script, at
the top, I have:
use strict;
use Modules::Init;
In Init.pm there are about 30 "use ..." lines. Using a basic test script
(test.pl) I enclosed the two lines above with a timer, ie:
use Devel::Timer;
my $t = Devel::Timer->new();
$t->mark("inits");
use strict;
use Modules::Init;
$t->mark("done init");
print $t->report();
That tells me that it took about 10 microseconds to run, which would be
great, however if I time the test script from the linux command line using:
time perl test.pl
it tells me that the script took about 1.6 seconds.
Evidently, the idea of use'ing all the modules in one place isn't going to
be a good one as it'll slow things down too much, but what I don't
understand, and was wondering if someone could clarify for me, is why there
is such a big difference in the two methods of timing?
Thanks
Bigus
I have a load of scripts that use various different cpan modules and I
thought to tidy up the header of each script I'd try bundling all the "use
..." commands into one init file in my modules folder. So in each script, at
the top, I have:
use strict;
use Modules::Init;
In Init.pm there are about 30 "use ..." lines. Using a basic test script
(test.pl) I enclosed the two lines above with a timer, ie:
use Devel::Timer;
my $t = Devel::Timer->new();
$t->mark("inits");
use strict;
use Modules::Init;
$t->mark("done init");
print $t->report();
That tells me that it took about 10 microseconds to run, which would be
great, however if I time the test script from the linux command line using:
time perl test.pl
it tells me that the script took about 1.6 seconds.
Evidently, the idea of use'ing all the modules in one place isn't going to
be a good one as it'll slow things down too much, but what I don't
understand, and was wondering if someone could clarify for me, is why there
is such a big difference in the two methods of timing?
Thanks
Bigus