threads / discuss / 48255

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

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

## tl;dr

One message between Apr 10, 2018 and Apr 10, 2018.

replies: 0people: 1as markdown or json

Ofer Koren· Apr 10, 2018, 09:57 UTC · lore

---------------- 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

← back to recent threads