in reply to Re: Require Load Times
in thread Require Load Times
Whenever you call a method, Perl has to figure out what that method is. While the search rules are clear, the search can be slow. So what Perl does is assumes that when you call a method once, you are likely to call it again, and so it stores in an internal hash the information about where the method is so that next time the lookup will be fast.
Unfortunately if you change any information which could change the lookup results, Perl has to throw away this cache and start over because it can no longer trust the answers. Normally this isn't much of a problem because people tend to use everything, define all of their functions, and then start calling methods (which builds the cache). So once you start running your code, your cache never gets thrown away again.
Unfortunately dynamic changing of functions at runtime (which is what autoloading them does) means that in the middle of running your code you are forced to throw away your cache. Do this repeatedly and you spend a lot of startup time building up bits of this cache only to throw it away again and start over.
If your process runs for a long time, or if you can arrange to preload everything that you are going to use up front, this is not an issue.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re (tilly) 2: Require Load Times
by demerphq (Chancellor) on Jan 06, 2002 at 01:59 UTC |