See PHI2043.
Currently, the cost to update repositories with large numbers of refs (30K+) is unreasonably high. A trivial test repository with 65K refs takes 24s to update locally.
75% of this cost is three calls to git for-each-ref .... These can be cached; one is for an issue from T5839 that may no longer be relevant.
For hosted repositories, we should be able to bail out of this process instantly in all cases where no updates have occurred.
For observed repositories, we should be able to bail out after confirming that the output of git for-each-ref has not changed.