Optimize network graph by skipping expensive commit centering
What does this MR do and why?
Contributes to https://gitlab.com/gitlab-com/gl-infra/production-engineering/-/issues/27625
Problem
The network graph's count_to_display_commit_in_center method
performs an expensive operation to center a specific commit in
the visualization by repeatedly fetching batches of 650 commits
until it finds the target commit's position.
Solution
When the optimize_network_graph_calculations feature flag is enabled,
use Repository#count_commits (git rev-list --count) to efficiently
calculate the distance between a commit and the head ref, instead of
iterating through commits one by one.
The unused find_commits method is also removed as it has been
superseded by list_commits.
References
https://gitlab.com/gitlab-com/gl-infra/production-engineering/-/issues/27625
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.