summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Template.pm
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2012-10-12 00:41:57 +0200
committerDave Lawrence <dlawrence@mozilla.com>2012-10-12 00:41:57 +0200
commit3b4065719921c2dc6f620aa5aa17d33c7d6d1c95 (patch)
tree234fe8a7e9aee10efdc41b1cbc0ae05afc610608 /Bugzilla/Template.pm
parentf9decb719a83f4cc15ef483f032c7cd1c37bce10 (diff)
downloadbugzilla-3b4065719921c2dc6f620aa5aa17d33c7d6d1c95.tar.gz
bugzilla-3b4065719921c2dc6f620aa5aa17d33c7d6d1c95.tar.xz
Bug 799257 - Backport bug 795650 and bug 797833 to bmo/4.0 and bmo/4.2 for performance improvement
r=glob
Diffstat (limited to 'Bugzilla/Template.pm')
-rw-r--r--Bugzilla/Template.pm9
1 files changed, 9 insertions, 0 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index 245d881d3..b35a9d269 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -997,6 +997,12 @@ sub create {
'default_authorizer' => new Bugzilla::Auth(),
},
};
+ # Use a per-process provider to cache compiled templates in memory across
+ # requests.
+ my $provider_key = join(':', @{ $config->{INCLUDE_PATH} });
+ my $shared_providers = Bugzilla->process_cache->{shared_providers} ||= {};
+ $shared_providers->{$provider_key} ||= Template::Provider->new($config);
+ $config->{LOAD_TEMPLATES} = [ $shared_providers->{$provider_key} ];
local $Template::Config::CONTEXT = 'Bugzilla::Template::Context';
@@ -1078,6 +1084,9 @@ sub precompile_templates {
# If anything created a Template object before now, clear it out.
delete Bugzilla->request_cache->{template};
+ # Clear out the cached Provider object
+ Bugzilla->process_cache->{shared_providers} = undef;
+
print install_string('done') . "\n" if $output;
}