How to improve git log performance?

前端 未结 4 1558
鱼传尺愫
鱼传尺愫 2020-12-10 16:23

I am trying to extract git logs from a few repositories like this:

git log --pretty=format:%H\\t%ae\\t%an\\t%at\\t%s --numstat

For larger r

4条回答
  •  再見小時候
    2020-12-10 16:54

    My first thought was to improve your IO, but I tested against the rails repository using an SSD and got a similar result: 30 seconds.

    --numstat is what's slowing everything down, otherwise git-log can complete in 1 second even with the formatting. Doing a diff is expensive, so if you can remove that from your process that will speed things up immensely. Perhaps do it after the fact.

    Otherwise if you filter the log entries using git-log's own search facilities that will reduce the number of entries which need to do a diff. For example, git log --grep=foo --numstat takes just one second.They're in the docs under "Commit Limiting". This can greatly reduce the number of entries git has to format. Revision ranges, date filters, author filters, log message grepping... all this can improve the performance of git-log on a large repository while doing an expensive operation.

提交回复
热议问题