Skip to content

Commit

Permalink
Use concat for better performance
Browse files Browse the repository at this point in the history
Use concat for better performance, at higher volumes, the
+= is doing a significant slowdown, sicne it always creates
a new array.
  • Loading branch information
Ladas committed Jul 24, 2017
1 parent d7be775 commit 8edbee2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/manager_refresh/inventory_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -405,15 +405,15 @@ def initialize(model_class: nil, manager_ref: nil, association: nil, parent: nil
end

def store_created_records(records)
@created_records += records_identities(records)
@created_records.concat(records_identities(records))
end

def store_updated_records(records)
@updated_records += records_identities(records)
@updated_records.concat(records_identities(records))
end

def store_deleted_records(records)
@deleted_records += records_identities(records)
@deleted_records.concat(records_identities(records))
end

def to_a
Expand Down

0 comments on commit 8edbee2

Please sign in to comment.