[Israel.pm] use and require

Gabor Szabo szabgab at gmail.com
Sun Mar 20 02:37:52 PDT 2011


On Sun, Mar 20, 2011 at 11:20 AM, Shmuel Fomberg <owner at semuel.co.il> wrote:
> Hi Gabor.
>
>> I think it totally depends on the usage pattern. For a persistent web
>> application loading everything up front won't hurt performance.
>> For an editor where people want to start typing ASAP and don't
>> want to wait for all the subsystems to load you will serve them better
>> by delaying everything as much as possible.
> In the case of an editor, I would expect it to load a minimum on
> startup, but then load silently all the other features, so the user
> won't need to wait when he needs them.
> And there, in the code that loads the features, there should be all the
> requires.

Let me take a look at the source code of Padre.

$ ack require lib/ | wc -l
385

If I actually look at the result I can see thing like this:

require Padre::File::Local;
require Padre::File::HTTP;
require Padre::File::FTP;
require Padre::File::Local;
require PPIx::EditorTools::FindVariableDeclaration;
require PPIx::EditorTools::FindUnmatchedBrace;
require PPIx::EditorTools::RenameVariable;

Shall we load all these modules and take up memory
space even if the user never uses any of the features?

Gabor


More information about the Perl mailing list