So, with about 2 minutes investigation, Devel::NYTProf reveals that this will halve the time of my regression test for a work module:
use Memoize; memoize 'Config::Any::plugins';
Sadly it won't work out for me whether that's the right thing to do, or whether there's a more correct fix to solve the real underlying problem.
Hah, that's interesting
Yes, AFAIK Module::Pluggable doesn't cache its results, to each time you call ->plugins it will rescan the hierarchy
Usually people only load a config at startup once, so it's not typically a problem
In Config::Any:
{ my (@plugins, $loaded); sub plugins { return @plugins if $loaded; $loaded = 1; return @plugins = $finder->plugins } }
Re:Module::Pluggable
nicholas on 2009-06-07T21:39:07
Usually people only load a config at startup once, so it's not typically a problem
I am interested in startup times too, and we're using lots of little config files - hence this problem. I guess we're "special".
:-)