# Why is git log on large repos slower when outputting to tty?

3 messages from 2024-10-17 to 2024-10-18. Participants: Henry Qin, Jeff King.
Thread: https://gitlist.dev/t/62357

## Henry Qin, 2024-10-17 17:46

Subject: Why is git log on large repos slower when outputting to tty?
Message-ID: <CAO8bsPASzxoEwiYd7ABf4YZuyTexFnf2B2DXap6xsA6d98DAAw@mail.gmail.com>
URL: https://gitlist.dev/e/CAO8bsPASzxoEwiYd7ABf4YZuyTexFnf2B2DXap6xsA6d98DAAw%40mail.gmail.com

```
Details in my Stackoverflow question:

https://stackoverflow.com/questions/79099095/why-is-git-log-significantly-slower-when-outputting-to-a-tty

```

## Jeff King, 2024-10-18 04:22

Subject: Re: Why is git log on large repos slower when outputting to tty?
Message-ID: <20241018042246.GA2408674@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20241018042246.GA2408674%40coredump.intra.peff.net
In-Reply-To: <CAO8bsPASzxoEwiYd7ABf4YZuyTexFnf2B2DXap6xsA6d98DAAw@mail.gmail.com>

```
On Thu, Oct 17, 2024 at 10:46:17AM -0700, Henry Qin wrote:

> Details in my Stackoverflow question:
> 
> https://stackoverflow.com/questions/79099095/why-is-git-log-significantly-slower-when-outputting-to-a-tty

My first thought was "decorations", and indeed somebody gave that answer
in the stack overflow thread. The default for log.decorate is "auto",
which will turn them on when output is to a tty. You can set it to
"false" to disable it.

As for why decorations are slow: it is necessarily going to be at least
linear in the number of refs, since we have to build the reverse mapping
up front. Do you have a lot of refs? What does "git for-each-ref | wc
-l" say?

-Peff

```

## Henry Qin, 2024-10-18 04:28

Subject: Re: Why is git log on large repos slower when outputting to tty?
Message-ID: <CAO8bsPDEjDiiB9_ueBzDgLWt3GEcR4T=tYR2GXVAnfsoNxn-HA@mail.gmail.com>
URL: https://gitlist.dev/e/CAO8bsPDEjDiiB9_ueBzDgLWt3GEcR4T%3DtYR2GXVAnfsoNxn-HA%40mail.gmail.com
In-Reply-To: <20241018042246.GA2408674@coredump.intra.peff.net>

```
Hi Jeff,

Thanks for your reply!
This was actually discussed in the comment thread on SO as well.
Yes, I do have 15618 refs in that repo, and turning off decoration
indeed fixed the performance issue!

Thanks,
~Henry

On Thu, Oct 17, 2024 at 9:23 PM Jeff King <peff@peff.net> wrote:
>
> On Thu, Oct 17, 2024 at 10:46:17AM -0700, Henry Qin wrote:
>
> > Details in my Stackoverflow question:
> >
> > https://stackoverflow.com/questions/79099095/why-is-git-log-significantly-slower-when-outputting-to-a-tty
>
> My first thought was "decorations", and indeed somebody gave that answer
> in the stack overflow thread. The default for log.decorate is "auto",
> which will turn them on when output is to a tty. You can set it to
> "false" to disable it.
>
> As for why decorations are slow: it is necessarily going to be at least
> linear in the number of refs, since we have to build the reverse mapping
> up front. Do you have a lot of refs? What does "git for-each-ref | wc
> -l" say?
>
> -Peff

```
