diff options
author | Stan Hu <stanhu@gmail.com> | 2019-07-24 14:08:25 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-07-24 14:08:25 -0700 |
commit | 07a308ad1b3e4ac1c6a3d81a60dac5c4254281b9 (patch) | |
tree | 0f58b00d10eda0d7ee97255002bf051205db6dae /lib | |
parent | 35ec674ee69a04d771ed82eeb205c3cd527e4112 (diff) | |
download | gitlab-ce-07a308ad1b3e4ac1c6a3d81a60dac5c4254281b9.tar.gz |
Enable Rubocop Performance/ReverseEachsh-rubocop-reverse-each
`Array.reverse_each` is faster than `Array.reverse.each` because:
* reverse.each creates a new array then loops each element
* reverse_each loops in reverse order (no intermediate array created)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/profiler.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/gitlab/profiler.rb b/lib/gitlab/profiler.rb index 890228e5e78..615c0ec374c 100644 --- a/lib/gitlab/profiler.rb +++ b/lib/gitlab/profiler.rb @@ -166,7 +166,7 @@ module Gitlab [model, times.count, times.sum] end - summarised_load_times.sort_by(&:last).reverse.each do |(model, query_count, time)| + summarised_load_times.sort_by(&:last).reverse_each do |(model, query_count, time)| logger.info("#{model} total (#{query_count}): #{time.round(2)}ms") end end |