From f54d843e4e585274f724c97f1b10288d8798a63b Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Fri, 30 Jul 2010 22:12:46 +0200 Subject: 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 Edited to fix a typo [#4434] Signed-off-by: Jesse Wolfe --- lib/puppet/parser/compiler.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/puppet/parser/compiler.rb') diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb index 61bb13cb6..98cad952c 100644 --- a/lib/puppet/parser/compiler.rb +++ b/lib/puppet/parser/compiler.rb @@ -23,6 +23,7 @@ class Puppet::Parser::Compiler # We get these from the environment and only cache them in a thread # variable for the duration of the compilation. Thread.current[:known_resource_types] = nil + Thread.current[:env_module_directories] = nil end attr_reader :node, :facts, :collections, :catalog, :node_scope, :resources, :relationships -- cgit