Skip to content

git_diff OID calculation is expensive #1625

Closed
@jspahrsummers

Description

@jspahrsummers

On a repository with a large number of files and sizes all across the board, calculating an OID for each file in a diff against the working directory can be prohibitively expensive.

An example (truncated) call stack from ObjectiveGit:

Running     Time        Self    Symbol Name
4507.0ms    99.4%       0,0     +[GTDiff diffIndexToWorkingDirectoryInRepository:options:error:]
4507.0ms    99.4%       1,0     > git_diff_index_to_workdir
4505.0ms    99.3%       19,0    >> git_diff__from_iterators
3974.0ms    87.6%       97,0    >>> git_diff__oid_for_file
2331.0ms    51.4%       1,0     >>>> git_filters_load
1411.0ms    31.1%       2,0     >>>> git_odb__hashfd_filtered

Within git_odb__hashfd_filtered, roughly 75% of the time is spent in SHA1_Update (from libcrypto).

We actually have no need for the OIDs in our particular case, so an option to skip their calculation entirely would be awesome.

@arrbee @dannygreg

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions