# Performance (self-compiled vs. distributed)

3 messages from 2025-09-03 to 2025-09-04. Participants: D. Ben Knoble, Ben Knoble.
Thread: https://gitlist.dev/t/64085

## D. Ben Knoble, 2025-09-03 20:31

Subject: Performance (self-compiled vs. distributed)
Message-ID: <CALnO6CA3FkiOeF4w1TUf9S_UDTG_1iRxjEZcAkfrL_eqY+P26w@mail.gmail.com>
URL: https://gitlist.dev/e/CALnO6CA3FkiOeF4w1TUf9S_UDTG_1iRxjEZcAkfrL_eqY%2BP26w%40mail.gmail.com

```
I have an installation of Git at /usr/local/bin/git managed by
Homebrew. I'm also tinkering with building my own Git (+ patches) to
experiment with new features. Today I used "make install …" to get
that in ~/bin/git, but I'm noticing some performance problems. My
shell prompt started coming back slower, especially in a large
monorepo.

For example, inside said monorepo (apologies in advance; output is on
a computer I can't easily copy from):

    hyperfine -Ni -w10 {/usr/local,$HOME}/bin/git
    …
    /usr/local/bin/git ran 4.99 +/- 1.69 times faster than ~/bin/git

The difference is 22ms +/- 6.5ms (15.3ms–56.3ms) compared to 109.7ms
+/- 17.8ms (91.1ms–159.9ms).

My build recipe was

    export DEVELOPER=1
    export XML_CATALOG_FILES=/usr/local/etc/xml/catalog
    make -j "$(nproc)" all doc
    make install install-doc install-html

Which differs somewhat from Homebrew's recipe (namely, Perl & Python
path aren't set; nor is USE_LIBPCRE nor INSTALL_SYMLINKS… I'm ignoring
the "extras" for now). I wouldn't particularly expect any of those to
create an issue, though.

Any tips on debugging this would be greatly appreciated.

Some other tidbits:

    ls -lh@ {/usr/local,$HOME}/bin/git
    -rwxr-xr-x@ … 4.4M … ~/bin/git
        com.apple.provenance     11B
    -r-xr-xr-x@ … 3.5M … /usr/local/bin/git
        com.apple.provenance     11B

I wondered if quarantining was at play, and this seems to indicate it
isn't. It is interesting that my binary is so much bigger!

Source I compiled: https://github.com/benknoble/git/tree/ps-jj

PS I also noticed we put all the RelNotes in
$prefix/share/doc/git-doc/RelNotes/*.adoc; I might have expected those
to get turned into HTML, too?

-- 
D. Ben Knoble

```

## D. Ben Knoble, 2025-09-04 14:05

Subject: Re: Performance (self-compiled vs. distributed)
Message-ID: <CALnO6CCEF75uriogAEd5LfORJ-m9OmDcF7ubu-U_xLWwxfZWTQ@mail.gmail.com>
URL: https://gitlist.dev/e/CALnO6CCEF75uriogAEd5LfORJ-m9OmDcF7ubu-U_xLWwxfZWTQ%40mail.gmail.com
In-Reply-To: <CALnO6CA3FkiOeF4w1TUf9S_UDTG_1iRxjEZcAkfrL_eqY+P26w@mail.gmail.com>

```
On Wed, Sep 3, 2025 at 4:31 PM D. Ben Knoble <ben.knoble@gmail.com> wrote:
>
> I have an installation of Git at /usr/local/bin/git managed by
> Homebrew. I'm also tinkering with building my own Git (+ patches) to
> experiment with new features. Today I used "make install …" to get
> that in ~/bin/git, but I'm noticing some performance problems. My
> shell prompt started coming back slower, especially in a large
> monorepo.
>
> For example, inside said monorepo (apologies in advance; output is on
> a computer I can't easily copy from):
>
>     hyperfine -Ni -w10 {/usr/local,$HOME}/bin/git
>     …
>     /usr/local/bin/git ran 4.99 +/- 1.69 times faster than ~/bin/git
>
> The difference is 22ms +/- 6.5ms (15.3ms–56.3ms) compared to 109.7ms
> +/- 17.8ms (91.1ms–159.9ms).
>
> My build recipe was
>
>     export DEVELOPER=1
>     export XML_CATALOG_FILES=/usr/local/etc/xml/catalog
>     make -j "$(nproc)" all doc
>     make install install-doc install-html

Interesting. It was suggested off-list that I should try building with
CFLAGS=-Oz, which I'm having some trouble propagating (with V=1, I see
some initial files built with -Oz and then later some with -O2??).

But on my other (non-corporate-managed) machine, I see almost no
timing difference between a built Git and a Homebrew-installed Git. So
I wonder if the corporate binary sniffer is causing problems…

-- 
D. Ben Knoble

```

## Ben Knoble, 2025-09-04 21:59

Subject: Re: Performance (self-compiled vs. distributed)
Message-ID: <E66D04C7-BAA7-48EA-997C-2E399CEE769F@gmail.com>
URL: https://gitlist.dev/e/E66D04C7-BAA7-48EA-997C-2E399CEE769F%40gmail.com
In-Reply-To: <CALnO6CCEF75uriogAEd5LfORJ-m9OmDcF7ubu-U_xLWwxfZWTQ@mail.gmail.com>

```

> Le 4 sept. 2025 à 10:05, D. Ben Knoble <ben.knoble@gmail.com> a écrit :
> 
> ﻿On Wed, Sep 3, 2025 at 4:31 PM D. Ben Knoble <ben.knoble@gmail.com> wrote:
>> 
>> I have an installation of Git at /usr/local/bin/git managed by
>> Homebrew. I'm also tinkering with building my own Git (+ patches) to
>> experiment with new features. Today I used "make install …" to get
>> that in ~/bin/git, but I'm noticing some performance problems. My
>> shell prompt started coming back slower, especially in a large
>> monorepo.
>> 
>> For example, inside said monorepo (apologies in advance; output is on
>> a computer I can't easily copy from):
>> 
>>    hyperfine -Ni -w10 {/usr/local,$HOME}/bin/git
>>    …
>>    /usr/local/bin/git ran 4.99 +/- 1.69 times faster than ~/bin/git
>> 
>> The difference is 22ms +/- 6.5ms (15.3ms–56.3ms) compared to 109.7ms
>> +/- 17.8ms (91.1ms–159.9ms).
>> 
>> My build recipe was
>> 
>>    export DEVELOPER=1
>>    export XML_CATALOG_FILES=/usr/local/etc/xml/catalog
>>    make -j "$(nproc)" all doc
>>    make install install-doc install-html
> 
> Interesting. It was suggested off-list that I should try building with
> CFLAGS=-Oz, which I'm having some trouble propagating (with V=1, I see
> some initial files built with -Oz and then later some with -O2??)

Fixed this, which helped with the binary size…


> But on my other (non-corporate-managed) machine, I see almost no
> timing difference between a built Git and a Homebrew-installed Git. So
> I wonder if the corporate binary sniffer is causing problems…

…but not speed. Sigh. Assuming I can rule in or out the corporate parts, I’ll keep troubleshooting. Might try to install to the Homebrew paths just to see what happens. (I’m assuming the sniffer uses a fingerprint though and not just the path.)
```
