Skip to content

Commit

Permalink
Merge pull request #23 from flownative/task/getobjects-speedup
Browse files Browse the repository at this point in the history
Avoid array_merge in loop in getObjects()
  • Loading branch information
kdambekalns committed Feb 3, 2022
2 parents fe93774 + fd1d0e5 commit 198277b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Classes/GcsStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,10 @@ public function getObjects()
{
$objects = [];
foreach ($this->resourceManager->getCollectionsByStorage($this) as $collection) {
/** @noinspection SlowArrayOperationsInLoopInspection */
$objects = array_merge($objects, $this->getObjectsByCollection($collection));
$objects[] = $this->getObjectsByCollection($collection);
}
return $objects;

return array_merge([], ...$objects); // the empty array covers cases when no loops were made
}

/**
Expand Down

0 comments on commit 198277b

Please sign in to comment.