git log slow - due to fetching ref name prefixes despite format string not needing them
- From
- Ofer Koren <ofer@weka.io>
- Date
- Apr 10, 2018, 09:57 UTC
- Message-ID
- <CAOt29zrv1Wnu8ZWnY9NZS5J36=16r0t=gMCM3_94SFC_fovnfA@mail.gmail.com>
---------------- Slow:
>> time git log --oneline --no-color --format="%h %ae %at" bd4d00302a^1..bd4d00302a^2
1049ee2882 eyal@weka.io 1518954558 c0e107f167 eyal@weka.io 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@weka.io 1518954558 c0e107f167 eyal@weka.io 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