•  
      request #21363 Tracker reports iterate twice on the matching IDs
    Infos
    #21363
    Thomas Gerbet (tgerbet)
    2021-05-17 16:45
    2021-05-17 14:42
    22959
    Details
    Tracker reports iterate twice on the matching IDs

    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:

    Trackers
    All
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Thomas Gerbet (tgerbet)
    Closed
    2021-05-17
    Attachments
    References

    Follow-ups

    User avatar
    Thomas Gerbet (tgerbet)2021-05-17 14:46

    • Summary
      -Tracker reports iterates twice on the matching IDs 
      +Tracker reports iterate twice on the matching IDs 
    • Status changed from Under implementation to Under review