Solved

Any performance issue if too many module is use

Posted on 2002-04-07
1
133 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Perl Regular expression 9 199
Question about @INC variable in perl 1 55
Parse csv file and generate graphs in HTML in bash 8 158
How to generate square thumbnail using perl 13 77
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

867 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now