aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorRichard Schneeman <richard.schneeman+no-recruiters@gmail.com>2018-10-04 07:55:59 +0800
committerGitHub <noreply@github.com>2018-10-04 07:55:59 +0800
commit4dbb75bd6e1ae675f81767e41538bac846f2e964 (patch)
tree57fc9011f32116b859cc86ddb85ca8de73d74b31 /activesupport
parentc55fc43b3fbdb630def9dd4502adc9c36ee87406 (diff)
parent6da99b4e99c90c63015f0d1cb4bf10983ea26a36 (diff)
downloadrails-4dbb75bd6e1ae675f81767e41538bac846f2e964.tar.gz
rails-4dbb75bd6e1ae675f81767e41538bac846f2e964.tar.bz2
rails-4dbb75bd6e1ae675f81767e41538bac846f2e964.zip
Merge pull request #33936 from schneems/schneems/cache-micro-optimizations
Decrease memory allocations in cache.rb
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/cache.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb
index a5d0c52b13..222ef2b515 100644
--- a/activesupport/lib/active_support/cache.rb
+++ b/activesupport/lib/active_support/cache.rb
@@ -596,9 +596,13 @@ module ActiveSupport
# Merges the default options with ones specific to a method call.
def merged_options(call_options)
if call_options
- options.merge(call_options)
+ if options.empty?
+ call_options
+ else
+ options.merge(call_options)
+ end
else
- options.dup
+ options
end
end