1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Reduce Array allocations

This commit is contained in:
Akira Matsuda 2019-07-31 17:30:25 +09:00
parent c46172171b
commit 34a7e68bb9
2 changed files with 4 additions and 4 deletions

View file

@ -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

View file

@ -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)