Solved

Any performance issue if too many module is use

Posted on 2002-04-07
1
136 Views
Last Modified: 2010-03-05
I have a standard config file that is use in most of my cgi script. In the configuration I have add a list of module. However not all my cgi script are using all the module declare in the config file.

I would like to know if I add more module as time goes by, will those cgi script that use only one or 2 of the module get slow down by loading that many module through the config file?

Below is sample config file and a sample cgi script that I used.

Sample cgi script (test.cgi)
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
use CGI qw(:standard);
warningsToBrowser(1);
require 'config.pl';

print header;
print "Testing only";
print end_html;


Sample config file (config.pl)
#!/usr/bin/perl
######################
# Declare module use #
######################

use DBI;
use Time::Local;
use HTML::Template;
use Image::Size ':all';  
use Image::Magick;
use File::Path;
use Net::SMTP;

0
Comment
Question by:ghgan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 12

Accepted Solution

by:
geotiger earned 20 total points
ID: 6926549
The answer is YES. The more module that you import, it takes longer to start the program and uses more memory.

It is because that use imports some semantics into the current package from the named module, generally by aliasing certain subroutine or variable names into your package.  It is exactly equivalent to

  BEGIN { require Module; import Module LIST; }

except that Module must be a bareword.


Geotiger.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question