mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-09 12:46:07 +10:00
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.
14 lines
335 B
Ruby
14 lines
335 B
Ruby
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
|