Use dedicated method for counting commits, branches, and tags and cache the output
Currently the view app/views/projects/commits/_head.html.haml
counts the amount of commits, branches, and tags using the following 3 snippets of code respectively:
@repository.commit_count
@repostiory.branches.size
@repository.tags.length
For each case a dedicated method should be added that basically does the above but caches the output. The cache in turn should be flushed whenever new tags/branches/commits are pushed or existing ones are removed.
When navigating to the branches page of my local GitLab CE clone the time used for counting tags is already around 500 ms (when using my slow FS). The timings for commits/branches may vary, but in general there's no point in counting this live.