Skip to content

Commit

Permalink
Optimise the rebuild further for the legacy data structure
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdoug committed Sep 15, 2019
1 parent 660a027 commit 30aaef1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/VolumePacker.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,9 @@ protected function checkDimensionalConstraints(Item $itemToPack)
*/
protected function rebuildItemList()
{
$this->items = ItemList::fromArray(array_merge($this->skippedItems, iterator_to_array($this->items)));
$this->skippedItems = [];
while(count($this->skippedItems)) {
$this->items->insert(array_pop($this->skippedItems));
}
}

/**
Expand Down

0 comments on commit 30aaef1

Please sign in to comment.