diff options
author | Igor <idrozdov@gitlab.com> | 2019-03-28 15:11:37 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2019-03-28 15:11:37 +0300 |
commit | db68003e8b18e46fdfc91f0ca3030a18478b1085 (patch) | |
tree | 0e97e4b53e9ba69e44eaa95355ed475ca030ff39 /lib | |
parent | b8e9a3797f55073cbdd3cb7d711982a948704ca5 (diff) |
Memoize old_blob and new_blob to improve performance
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/diff/file.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/gitlab/diff/file.rb b/lib/gitlab/diff/file.rb index dce80bf21de..c46087e65de 100644 --- a/lib/gitlab/diff/file.rb +++ b/lib/gitlab/diff/file.rb @@ -133,11 +133,15 @@ module Gitlab end def new_blob - new_blob_lazy&.itself + strong_memoize(:new_blob) do + new_blob_lazy&.itself + end end def old_blob - old_blob_lazy&.itself + strong_memoize(:old_blob) do + old_blob_lazy&.itself + end end def new_blob_lines_between(from_line, to_line) |