Berkeley CSUA MOTD:Entry 35061
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/05/25 [General] UID:1000 Activity:popular
5/25    

2004/11/24-26 [Computer/SW/Languages/Perl] UID:35061 Activity:nil
11/24   I was looking at the Perl CGI.pm and I noticed that most of its
        functions existed only as source code stored in a big hash of
        %SUBS = (sub_name => 'sub source')  What's the reason for doing this?
        \_ They compile the functions on demand, to reduce startup time.
           \_ So if you make repeated calls to some of these functions, will
              you see much of a performance hit?
              \_ Nope -- once CGI.pm compiles a function, it becomes an
                 ordinary perl function with no extra overhead.  On the other
                 hand, even that single compilation is a waste if you're using
                 something like mod_perl that precompiles your code, so CGI.pm
                 does have an option (-compile) to disable the hack and just
                 define everything at compile time.  --mconst