From a34c61d9c6ff16d858faada0483a3230294f5988 Mon Sep 17 00:00:00 2001
From: Kamil Trzcinski <ayufan@ayufan.eu>
Date: Mon, 29 Jun 2015 11:38:48 +0200
Subject: [PATCH] Reuse HTML Pipeline object in Markdown parser

The patches reduces pressure on GC and reduces markdown processing time
---
 lib/gitlab/markdown.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb
index fa9c0975bb8..889decc9b48 100644
--- a/lib/gitlab/markdown.rb
+++ b/lib/gitlab/markdown.rb
@@ -54,7 +54,7 @@ module Gitlab
         current_user:         current_user
       )
 
-      pipeline = HTML::Pipeline.new(filters)
+      @pipeline ||= HTML::Pipeline.new(filters)
 
       context = {
         # SanitizationFilter
@@ -79,7 +79,7 @@ module Gitlab
         project_wiki:   @project_wiki
       }
 
-      result = pipeline.call(text, context)
+      result = @pipeline.call(text, context)
 
       save_options = 0
       if options[:xhtml]
-- 
GitLab