From 670ea222ff6b4e7b1d544c939972a7252665e3fc Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Thu, 1 Mar 2012 23:24:08 +0100 Subject: Bug 731562: Cache the global/user.html.tmpl template for improved performance r=dkl a=LpSolit --- template/en/default/bug/comments.html.tmpl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'template/en/default/bug/comments.html.tmpl') diff --git a/template/en/default/bug/comments.html.tmpl b/template/en/default/bug/comments.html.tmpl index d6a9fcca2..0bdb37586 100644 --- a/template/en/default/bug/comments.html.tmpl +++ b/template/en/default/bug/comments.html.tmpl @@ -46,6 +46,7 @@ [% DEFAULT start_at = 0 mode = "show" %] [% sort_order = user.settings.comment_sort_order.value %] +[% user_cache = template_cache.users %] [%# NOTE: (start_at > 0) means we came here from a midair collision, # in which case we don't care what the user's preference is. @@ -170,12 +171,18 @@ - [% INCLUDE global/user.html.tmpl who = comment.author %] + [%# No need to recreate the exact same template if we already have it. %] + [% commenter_id = comment.author.id %] + [% UNLESS user_cache.$commenter_id %] + [% user_cache.$commenter_id = BLOCK %] + [% INCLUDE global/user.html.tmpl who = comment.author %] + [% END %] + [% END %] + [% user_cache.$commenter_id FILTER none %] - [% FOREACH group = comment.author.groups %] - [% NEXT UNLESS group.icon_url %] + [% FOREACH group = comment.author.groups_with_icon %] [% group.name FILTER html %] -- cgit v1.2.3-24-g4f1b