-
Speed up used languages calculation on charts page · fe0898ccSean McGivern authored
We removed calls from our code to Rugged::Repository#fetch_attributes: <https://gitlab.com/gitlab-org/gitlab_git/commit/340e111e040ae847b614d35b4d3173ec48329015> However, we didn't remove calls from within Linguist. This method is only called when calculating the languages for a repository on the Charts page: <https://github.com/github/linguist/blob/v4.7.0/lib/linguist/lazy_blob.rb#L33-L36> We can safely use our own Gitlab::Git::Attributes here. On staging, for the GitLab CE repo, this makes the calculation take about a third of the time: # Before Benchmark.realtime do Linguist::Repository.new(repository.rugged, repository.rugged.head.target_id).languages end #=> 23.67193900188431 # After Benchmark.realtime do Linguist::Repository.new(repository.rugged, repository.rugged.head.target_id).languages end #=> 8.945212290156633
fe0898cc
×