Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-03-24 19:00:26 +0300
committerYorick Peterse <yorickpeterse@gmail.com>2016-04-01 12:13:48 +0300
commit84b0ab77667b85a42db8a5a02d9758657af66f16 (patch)
tree5058f048563c8d8e8be4b7e0837d919ff0a878d4 /lib/gitlab/routing.rb
parent82539cff700931532b22b6a8e3d6832137fc5d55 (diff)
Added & use Gitlab::Routing for URL helpers
Rails' "url_helpers" method creates an anonymous Module (which a bunch of methods) on every call. By caching the output of this method in a dedicated method we can shave off about 10 seconds of loading time for an issue with around 200 comments.
Diffstat (limited to 'lib/gitlab/routing.rb')
-rw-r--r--lib/gitlab/routing.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/gitlab/routing.rb b/lib/gitlab/routing.rb
new file mode 100644
index 00000000000..5132177de51
--- /dev/null
+++ b/lib/gitlab/routing.rb
@@ -0,0 +1,13 @@
+module Gitlab
+ module Routing
+ # Returns the URL helpers Module.
+ #
+ # This method caches the output as Rails' "url_helpers" method creates an
+ # anonymous module every time it's called.
+ #
+ # Returns a Module.
+ def self.url_helpers
+ @url_helpers ||= Gitlab::Application.routes.url_helpers
+ end
+ end
+end