Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Script Execution time and Use
April 1, 2009, 11:14 am
rate this thread
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:
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:
my $t = Devel::Timer->new();
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?
- » FAQ 3.27 Where can I learn about linking C with Perl?
- — Next thread in » PERL Discussions
- » FAQ 3.23 Can I write useful Perl programs on the command line?
- — Previous thread in » PERL Discussions