Web lists-archives.com

git log slow - due to fetching ref name prefixes despite format string not needing them




----------------
Slow:

>> time git log --oneline --no-color --format="%h %ae %at" bd4d00302a^1..bd4d00302a^2
1049ee2882 eyal@xxxxxxx 1518954558
c0e107f167 eyal@xxxxxxx 1518954522

real 0m0.119s
user 0m0.104s
sys 0m0.012s

----------------
Fast:

>> time git log --no-decorate --oneline --no-color --format="%h %ae %at" bd4d00302a^1..bd4d00302a^2
1049ee2882 eyal@xxxxxxx 1518954558
c0e107f167 eyal@xxxxxxx 1518954522

real 0m0.011s
user 0m0.004s
sys 0m0.004s

----------------
As you can see the output is identical, but the first execution is 10
times slower. Using strace I've found the cause of the difference to
be traversal of the '.git/refs/heads/*' folders.

Regards,

- Ofer Koren