diff options
author | Akira Matsuda <ronnie@dio.jp> | 2019-07-31 17:30:25 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2019-07-31 17:41:34 +0900 |
commit | 34a7e68bb9a7fa07c12092d916317f837b422a6a (patch) | |
tree | c8f3764a5f3009945e0e3086afeff699a3ea94b8 | |
parent | c46172171b7beadcd28d71c1d5473b1bde0f7ede (diff) | |
download | rails-34a7e68bb9a7fa07c12092d916317f837b422a6a.tar.gz rails-34a7e68bb9a7fa07c12092d916317f837b422a6a.tar.bz2 rails-34a7e68bb9a7fa07c12092d916317f837b422a6a.zip |
Reduce Array allocations
-rw-r--r-- | actionpack/lib/action_dispatch/http/cache.rb | 4 | ||||
-rw-r--r-- | activerecord/lib/active_record/query_cache.rb | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/http/cache.rb b/actionpack/lib/action_dispatch/http/cache.rb index 7be30be77a..0258d85564 100644 --- a/actionpack/lib/action_dispatch/http/cache.rb +++ b/actionpack/lib/action_dispatch/http/cache.rb @@ -150,8 +150,8 @@ module ActionDispatch directive, argument = segment.split("=", 2) if SPECIAL_KEYS.include? directive - key = directive.tr("-", "_") - cache_control[key.to_sym] = argument || true + directive.tr!("-", "_") + cache_control[directive.to_sym] = argument || true else cache_control[:extras] ||= [] cache_control[:extras] << segment diff --git a/activerecord/lib/active_record/query_cache.rb b/activerecord/lib/active_record/query_cache.rb index 43a21e629e..881ba623b8 100644 --- a/activerecord/lib/active_record/query_cache.rb +++ b/activerecord/lib/active_record/query_cache.rb @@ -29,10 +29,10 @@ module ActiveRecord pools = [] ActiveRecord::Base.connection_handlers.each do |key, handler| - pools << handler.connection_pool_list.reject { |p| p.query_cache_enabled }.each { |p| p.enable_query_cache! } + pools.concat(handler.connection_pool_list.reject { |p| p.query_cache_enabled }.each { |p| p.enable_query_cache! }) end - pools.flatten + pools end def self.complete(pools) |