Skip to content

Commit

Permalink
Avoid extra Array allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
kamipo committed Jan 15, 2020
1 parent ac206e6 commit c900cdf
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -48,18 +48,18 @@ def load_records
raw_records = owner_keys.empty? ? [] : records_for(owner_keys)

@preloaded_records = raw_records.select do |record|
assignments = []
assignments = false

owners_by_key[convert_key(record[association_key_name])].each do |owner|
entries = (@records_by_owner[owner] ||= [])

if reflection.collection? || entries.empty?
entries << record
assignments << record
assignments = true
end
end

!assignments.empty?
assignments
end
end

Expand Down

0 comments on commit c900cdf

Please sign in to comment.