{"thread":{"id":"62357","subject":"Why is git log on large repos slower when outputting to tty?","startedAt":"2024-10-17T17:46:51Z","lastAt":"2024-10-18T04:28:29Z","messageCount":3,"participants":["Henry Qin","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"505380","messageId":"CAO8bsPASzxoEwiYd7ABf4YZuyTexFnf2B2DXap6xsA6d98DAAw@mail.gmail.com","threadId":"62357","inReplyTo":null,"subject":"Why is git log on large repos slower when outputting to tty?","fromName":"Henry Qin","fromEmail":"root@hq6.me","sentAt":"2024-10-17T17:46:17Z","receivedAt":"2024-10-17T17:46:51Z","isPatch":false,"sender":{"key":"root@hq6.me","avatar":null},"body":"Details in my Stackoverflow question:\n\nhttps://stackoverflow.com/questions/79099095/why-is-git-log-significantly-slower-when-outputting-to-a-tty\n"},{"id":"505401","messageId":"20241018042246.GA2408674@coredump.intra.peff.net","threadId":"62357","inReplyTo":"CAO8bsPASzxoEwiYd7ABf4YZuyTexFnf2B2DXap6xsA6d98DAAw@mail.gmail.com","subject":"Re: Why is git log on large repos slower when outputting to tty?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2024-10-18T04:22:46Z","receivedAt":"2024-10-18T04:22:54Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Oct 17, 2024 at 10:46:17AM -0700, Henry Qin wrote:\n\n> Details in my Stackoverflow question:\n> \n> https://stackoverflow.com/questions/79099095/why-is-git-log-significantly-slower-when-outputting-to-a-tty\n\nMy first thought was \"decorations\", and indeed somebody gave that answer\nin the stack overflow thread. The default for log.decorate is \"auto\",\nwhich will turn them on when output is to a tty. You can set it to\n\"false\" to disable it.\n\nAs for why decorations are slow: it is necessarily going to be at least\nlinear in the number of refs, since we have to build the reverse mapping\nup front. Do you have a lot of refs? What does \"git for-each-ref | wc\n-l\" say?\n\n-Peff\n"},{"id":"505402","messageId":"CAO8bsPDEjDiiB9_ueBzDgLWt3GEcR4T=tYR2GXVAnfsoNxn-HA@mail.gmail.com","threadId":"62357","inReplyTo":"20241018042246.GA2408674@coredump.intra.peff.net","subject":"Re: Why is git log on large repos slower when outputting to tty?","fromName":"Henry Qin","fromEmail":"root@hq6.me","sentAt":"2024-10-18T04:28:02Z","receivedAt":"2024-10-18T04:28:29Z","isPatch":false,"sender":{"key":"root@hq6.me","avatar":null},"body":"Hi Jeff,\n\nThanks for your reply!\nThis was actually discussed in the comment thread on SO as well.\nYes, I do have 15618 refs in that repo, and turning off decoration\nindeed fixed the performance issue!\n\nThanks,\n~Henry\n\nOn Thu, Oct 17, 2024 at 9:23 PM Jeff King <peff@peff.net> wrote:\n>\n> On Thu, Oct 17, 2024 at 10:46:17AM -0700, Henry Qin wrote:\n>\n> > Details in my Stackoverflow question:\n> >\n> > https://stackoverflow.com/questions/79099095/why-is-git-log-significantly-slower-when-outputting-to-a-tty\n>\n> My first thought was \"decorations\", and indeed somebody gave that answer\n> in the stack overflow thread. The default for log.decorate is \"auto\",\n> which will turn them on when output is to a tty. You can set it to\n> \"false\" to disable it.\n>\n> As for why decorations are slow: it is necessarily going to be at least\n> linear in the number of refs, since we have to build the reverse mapping\n> up front. Do you have a lot of refs? What does \"git for-each-ref | wc\n> -l\" say?\n>\n> -Peff\n"}]}