[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] require



>
>What is, if any, the overhead or latency associated with the "require" 
>statement.  I have a script that can return _a_lot_ of data to WebStar, 
>and I try and cut down any runtime that I can.  If "require" only takes .5 
>secs or less to read things in, and the read data is in the regular perl 
>environment then it is not severe.

I wouldn't worry about it too much. As far as I can see, the time it
takes to compile all of the code should be almost constant.

Lets say you have a 50 line script that "require"s a 25 line library.
If you cut and pasted the library inline at the top of the script,
perl would compile all 75 lines and then start executing the its
internal representation of the code. If you kept the library as a
separate file, perl would comple 50 lines, start executing any
statements before the "require" statement, and then compile 25 lines.
-- 
Andrew Langmead