git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Why is --pretty=format: so slow?

From
Paul Mackerras <paulus@samba.org>
Date
Nov 4, 2007, 03:42 UTC
Message-ID
<18221.16318.785162.44769@cargo.ozlabs.ibm.com>

For some reason, using --pretty=format:... with git log is much slower than other formats. For example, on the kernel tree (on my quad G5):

$ time git log --pretty=oneline >/dev/null

real 0m2.165s user 0m2.092s sys 0m0.070s

$ time git log --pretty=raw >/dev/null

real 0m2.426s user 0m2.358s sys 0m0.068s

$ time git log --pretty="format:%H" >/dev/null

real 0m7.843s user 0m6.282s sys 0m1.557s

$ time git log --pretty="format:%H {%P} %ct" >/dev/null

real 0m7.950s user 0m6.374s sys 0m1.573s

Strace seems to indicate that git log is doing at least one sequence of open, fstat64, fcntl64, getdents64 and close for each line of output in the --pretty=format: cases, but not in the other cases. This seems rather unnecessary - could it be fixed? I'd like to use the last format listed above with gitk, but not if it is going to make things 3 times slower.

Paul.
Next: Junio C Hamano
Message 1 of 5 in “Why is --pretty=format: so slow?”
  1. Paul MackerrasNov 4, 2007
  2. Junio C HamanoNov 4, 2007
  3. René ScharfeNov 4, 2007
  4. Junio C HamanoNov 4, 2007
  5. René ScharfeNov 4, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.