I am currently working on this feature to display graphs of the number of commits a branch is ahead and behind of the default branch.
I have a current semi-working implementation that creates a hash as needed of how many commits ahead/behind a branch is compared to
repository.root_ref. This hash is cached like many other high-computation items but for larger repositories, it can still break for repos with many branches (e.g. it fails on GitLab CE as included in the development kit and will almost certainly break on a 392 branch repo I use where I work).
Only 10 branches are needed at a time (paginated branch page), but the cache item calculates everything at once. I am wondering if there is a better way that would stay with the general architecture of GitLab. I am considering something along the lines of creating a cached item for each branch and then only needing to update them for 10 per page. I could do even do an AJAX request to get them asynchronously from the rest of the page (such as the network page).