Re: git blame vs git log --follow performance
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Jan 27, 2014, 02:34 UTC
- Message-ID
- <CACsJy8A2zpOejtaCd8y8vAJW1LV6to0WRD+es7g-7o2hEUiBxA@mail.gmail.com>
- In-Reply-To
- <1390770652.20150.25.camel@joe-AO722>
On Mon, Jan 27, 2014 at 4:10 AM, Joe Perches <joe@perches.com> wrote:
> Is there something that can be done about improving > git log --follow -- <file> performance to be nearly > equivalent speed to git blame -- <file> ?
Not strictly about --follow, but there is room for improvement for diff'ing in log in general. Right now we do "diff HEAD HEAD~1", "diff HEAD~1 HEAD~2" and so on (--follow needs diff to detect rename). At each step we load new tree objects and reparse. Notice after "diff HEAD HEAD~1" we may have "HEAD~1" and its subtrees read and parsed (not entirely). We could reuse that "diff HEAD~1 HEAD~2".
On git.git, "git log --raw" takes 10s and it seems tree object reading is about 2s.In ideal case we might be able to cut that to 1s. The tree parsing code (update_tree_entry) takes about 5s. We might be able to cut that in half, I'm not entirely sure. But there could be a lot of work in caching "HEAD~1" and the overhead may turn out too high for any gain.
-- Duy