Fix #4461 - attempt to fix another performance issue
During a profiling of a 2.6.1rc1 puppet master, I found that we
spend a lot of time and efforts in Puppet::Util::Autoload#module_directories.
Since this method is doing a bunch of filesystem access, this process is
slow.
In fact each time we were evaluating a resource or trying to find if a given
resource was a builtin type we ended up scanning the whole module directories
for the given environment.
This patch attempts to fix this performance issue by caching the module_directories
output for the either the time of the compilation or an agent configurer
run (since this stuff looks like to be shared for both compilation and
catalog evaluation).
With this patch, my compilation time for 2k resources went from 5.91s to
3.71s (second run each time to allievate parsing time)..
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Edited to fix a typo [#4434]
Signed-off-by: Jesse Wolfe <jes5199@gmail.com>