There is a easy performance gain to get when we retrieve the artifacts ID for a tracker report. Current code do something like that:
$matching_ids_result = $dao->searchMatchingIds(...);
if ($matching_ids_result) {
$matching_ids['id'] = implode(',', array_column(iterator_to_array($matching_ids_result), 'id'));
$matching_ids['last_changeset_id'] = implode(',', array_column(iterator_to_array($matching_ids_result), 'last_changeset_id'));
}
This is inefficient because because we will need to iterate twice the \DataAccessResult
object. On a report returning a somewhat large amount of results this can quickly be not negligible.
For example in this tracker, my report matches 7040 artifacts avoiding one call to iterator_to_array
saves about ~17% of the CPU time: