Skip to content

Slow Performance on file history for large repos #20764

Closed
@zeripath

Description

@zeripath

The use of git log --follow on getting file history causes increased slow-downs for large repositories and potentially makes the count incorect.

Example URL:

This is essentially:

git rev-list --count $REVISION -- $FILE_PATH

followed-by:

git log $REVISION --follow  --pretty=format:%H -- $FILE_PATH

The second one of these is so much slower than the first and it can actually produce different results for the number of commits due to the --follow on the second call. (which appears to be the cause of most of the slow downs.)

Now if it were not for --follow we could actually use git rev-list for both of these calls and the skip and max-count will be free (in contrast to the current system where the skip doesn't work.)

Looking at the history for this line I don't think there was reasoning behind adding the follow except that I would guess that it was nice to add.

So... a simple speed improvement here is to drop the follow and switch to rev-list for these calls.

An additional speed improvement is to add a deferrable route as in the commit infos page

Originally posted by @zeripath in #19812 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/enhancementAn improvement of existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions