mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #17487 from pabloh/avoid_allocations
Avoid unnecessary allocations and method calls
This commit is contained in:
commit
af9702c015
5 changed files with 5 additions and 5 deletions
|
@ -161,7 +161,7 @@ module ActiveRecord
|
|||
if scope.klass.primary_key
|
||||
count = scope.destroy_all.length
|
||||
else
|
||||
scope.to_a.each do |record|
|
||||
scope.each do |record|
|
||||
record._run_destroy_callbacks
|
||||
end
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def clear
|
||||
cache.values.each do |hash|
|
||||
cache.each_value do |hash|
|
||||
hash[:stmt].close
|
||||
end
|
||||
cache.clear
|
||||
|
|
|
@ -115,7 +115,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def clear
|
||||
cache.values.each do |hash|
|
||||
cache.each_value do |hash|
|
||||
dealloc hash[:stmt]
|
||||
end
|
||||
cache.clear
|
||||
|
|
|
@ -649,7 +649,7 @@ module ActiveRecord
|
|||
model_class
|
||||
end
|
||||
|
||||
reflection_class._reflections.values.each do |association|
|
||||
reflection_class._reflections.each_value do |association|
|
||||
case association.macro
|
||||
when :belongs_to
|
||||
# Do not replace association name with association foreign key if they are named the same
|
||||
|
|
|
@ -67,7 +67,7 @@ module ActiveSupport
|
|||
end
|
||||
|
||||
def eager_load!
|
||||
@_autoloads.values.each { |file| require file }
|
||||
@_autoloads.each_value { |file| require file }
|
||||
end
|
||||
|
||||
def autoloads
|
||||
|
|
Loading…
Reference in a new issue