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

Add Singleton in NullMutationTracker class

to reduce allocation of same object
This commit is contained in:
acapilleri 2015-10-03 16:11:02 +02:00
parent 55ac94cec4
commit c08c4681ad
2 changed files with 3 additions and 1 deletions

View file

@ -133,7 +133,7 @@ module ActiveRecord
end end
def previous_mutation_tracker def previous_mutation_tracker
@previous_mutation_tracker ||= NullMutationTracker.new @previous_mutation_tracker ||= NullMutationTracker.instance
end end
def cache_changed_attributes def cache_changed_attributes

View file

@ -46,6 +46,8 @@ module ActiveRecord
end end
class NullMutationTracker # :nodoc: class NullMutationTracker # :nodoc:
include Singleton
def changed_values def changed_values
{} {}
end end