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

git log with ordering option and --first-parent is unnecessarily slow

From
JBJosiah Boning <jboning@gmail.com>
Date
Apr 9, 2016, 03:55 UTC
Message-ID
<CAKdicq8MnZMBV97K5O8Oa1T=PT9DsutmBS+P-bFYitATHH3s+Q@mail.gmail.com>

As measured on linux.git, adding --date-order to a log command can result in a significant slowdown (~25x here; I've seen ~100x on other repositories):

    $ time git log --first-parent --max-count=51 master > /dev/null
    real    0m0.024s
    user    0m0.006s
    sys    0m0.016s
    $ time git log --date-order --first-parent --max-count=51 master > /dev/null
    real    0m0.652s
    user    0m0.570s
    sys    0m0.074s

In combination with --first-parent, --date-order (or any other ordering option) should be a no-op, since --first-parent selects a linear history. So it seems like there's a significant performance win available by ignoring ordering options when --first-parent is present. Would this change be desirable? If so, I'll see about submitting a patch.

More generally, it seems like it might be possible to identify when the selected commits are linear and avoid the cost of sorting.

Josiah
Next: Jeff King
Message 1 of 3 in “git log with ordering option and --first-parent is unnecessarily slow”
  1. Josiah BoningApr 9, 2016
  2. Jeff KingApr 9, 2016
  3. Josiah BoningApr 9, 2016

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.