In what scenarios libgit2 is faster than git?

Viewed 549

I can write a Zsh module with some subset of git-command features. The motivation is to accelerate prompts. Example prompt that I use does:

    changed_files=()
    git diff --quiet 2> /dev/null || changed_files=(${(f)"$( git diff --name-only 2>/dev/null )"})

This is not very fast when entering e.g. linux-kernel repo. I wonder if libgit2 could give more control over some typical tasks, and be faster this or other way.

I guess chances are low, because Git repository has simple structure, so git code is 1-to-1 reflection of it. But who knows? Any distinct libgit2 performance trait is in my interest.

1 Answers
Related