diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-03-24 18:41:48 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-04-01 12:13:30 +0300 |
commit | e7849b0b25390a96881d1f8affd1eadab4e9de62 (patch) | |
tree | 1520ff521f9c885f4987747b167e3be7b8182aad /app/models/label.rb | |
parent | 82539cff700931532b22b6a8e3d6832137fc5d55 (diff) |
Memoize reference_pattern/link_reference_pattern
These methods are called quite often in loops so by memoizing their
output we can reduce timings a bit.
Diffstat (limited to 'app/models/label.rb')
-rw-r--r-- | app/models/label.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/label.rb b/app/models/label.rb index 500d5a35521..55c01cae762 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -56,7 +56,7 @@ class Label < ActiveRecord::Base # This pattern supports cross-project references. # def self.reference_pattern - %r{ + @reference_pattern ||= %r{ (#{Project.reference_pattern})? #{Regexp.escape(reference_prefix)} (?: |