gitlab-org--gitlab-foss/changelogs/unreleased/speed-up-graphs.yml
Sean McGivern fe0898cc14 Speed up used languages calculation on charts page
We removed calls from our code to Rugged::Repository#fetch_attributes:
<340e111e04>

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
2017-06-16 11:14:41 +01:00

4 lines
85 B
YAML

---
title: Speed up used languages calculation on charts page
merge_request:
author: