Johannes Schindelin 37bff807b3 Drop mimalloc (#6231)
When 6a29c2dfec ("mingw: use mimalloc",
2019-06-24) introduced the vendored mimalloc, the comparison was against
`nedmalloc` (which by then had not seen an upstream commit since 2014,
and whose repository was archived in 2019). The two were essentially at
parity in that benchmark; mimalloc was chosen because it was actively
developed. I do not really recall whether the platform's *default*
allocator was not part of the comparison; If it was, the performance was
still worse than mimalloc, if it wasn't, I forgot to test ;-)

Six years on, with `nedmalloc` safely on its way to being dropped from
the upstream codebase entirely
(https://github.com/gitgitgadget/git/pull/2104, currently in `seen` as
e576abb9f8), the question is no longer "mimalloc vs nedmalloc" but
"mimalloc vs the OS allocator". Re-running the same `git repack -adfq`
benchmark against each platform's current default allocator finds no
measurable speedup from mimalloc on any of Windows, macOS, or Linux.

## Methods

I recapitulated the same benchmark as cited in 6a29c2dfec (the original
comparison was nedmalloc vs mimalloc on `git repack -adfq` over a subset
of `linux.git`), now extended to the three GitHub-hosted runners
(`ubuntu-latest`, `macos-latest`, `windows-latest`). Each job built two
`git` binaries from the same source tree, vanilla and
`USE_MIMALLOC=YesPlease`, then prepared a fresh bare clone of
`linux.git` to a fixed `SHA`, and ran the repacks with both built `git`s
in randomized order for five iterations. Each iteration ran both
binaries exactly once on a freshly `copytree`-ed copy of the immutable
template repository; the order *within* an iteration was randomized so
any per-iteration confounder (cache state, runner warm-up, neighbour-VM
contention) would be shared symmetrically between variants. Timings
excluded the `copytree`. The full driver is the Python script
`ci/bench-mimalloc.py` on the [`mimalloc-benchmark`
branch](https://github.com/dscho/git/tree/mimalloc-benchmark/ci).

## Results: original `linux v2.6.20`-era workload (49,917 commits,
431,605 objects, ~204 MB pack)

| Platform | vanilla mean ± stdev | mimalloc mean ± stdev | Δ (mimalloc
− vanilla) |
|---|---|---|---|
| `ubuntu-latest` | 27.089s ± 0.060s | 27.041s ± 0.065s | −0.048s
(−0.18%) |
| `macos-latest` | 23.259s ± 1.206s | 25.076s ± 2.279s | +1.817s (+7.8%)
|
| `windows-latest` | 29.828s ± 1.651s | 30.329s ± 2.428s | +0.501s
(+1.7%) |

Workflow run: https://github.com/dscho/git/actions/runs/25374127848

## Results: 4x larger `linux v3.0` workload (255,039 commits, 2,059,429
objects, ~788 MB pack)

| Platform | vanilla mean ± stdev | mimalloc mean ± stdev | Δ (mimalloc
− vanilla) |
|---|---|---|---|
| `ubuntu-latest` | 134.723s ± **0.329s** | 134.801s ± **0.191s** |
+0.078s (+0.06%) |
| `macos-latest` | 130.183s ± 19.098s | 133.292s ± 18.991s | +3.109s
(+2.4%) |
| `windows-latest` | 145.183s ± 1.272s | 146.271s ± 4.161s | +1.088s
(+0.75%) |

Workflow run: https://github.com/dscho/git/actions/runs/25376885309

## Discussion

The Linux numbers on the larger workload are particularly clear: stdev
is below 0.3% of the mean for both variants, and the difference is well
inside that floor. Glibc's allocator and the vendored mimalloc are
statistically indistinguishable for `git repack -adfq` here.

`windows-latest` runners are noisier (per-run variance ~1-4%, mostly
neighbour-VM scheduling), but mimalloc never beats vanilla in either
workload. With the original justification for keeping a custom allocator
gone (the modern Windows segment-heap is no longer the slow
Windows-XP-era `HeapAlloc` that drove the original 2009 nedmalloc
adoption), there is nothing left to motivate the maintenance cost of a
vendored allocator.

`macos-latest` is too noisy at n=5 (stdev 14% of the mean) to draw a
firm conclusion, but the visible point-estimate goes the wrong way and
there is no plausible mechanism by which Apple's `libsystem_malloc`
would be slower than mimalloc.

## What this PR does *not* do

It does not by itself remove `nedmalloc` from the tree; that is still
promised as a follow-up of the in-flight upstream patch
https://github.com/gitgitgadget/git/pull/2104, presently in `seen` as
e576abb9f8. The first commit here is an `amend!` whose autosquashed
result is byte-identical to that upstream commit, so once the next
merging-rebase picks up the upstream patch the two will collapse
cleanly.

The five remaining `fixup!` reverts target each of the original
mimalloc-vendoring commits in reverse chronological order; once
autosquashed, the pairs cancel out to empty commits which the rebase
will drop, leaving the tree free of `compat/mimalloc/`, the
`USE_MIMALLOC` build infrastructure, and the supporting changes
(`compat/posix.h` `_DEFAULT_SOURCE` guard, `win32_pthread_*` renames)
that only existed to support the vendored allocator.
2026-05-26 21:14:13 +02:00

Git for Windows

Contributor Covenant Open in Visual Studio Code Build status Join the chat at https://gitter.im/git-for-windows/git

This is Git for Windows, the Windows port of Git.

The Git for Windows project is run using a governance model. If you encounter problems, you can report them as GitHub issues, discuss them in Git for Windows' Discussions or on the Git mailing list, and contribute bug fixes.

To build Git for Windows, please either install Git for Windows' SDK, start its git-bash.exe, cd to your Git worktree and run make, or open the Git worktree as a folder in Visual Studio.

To verify that your build works, use one of the following methods:

  • If you want to test the built executables within Git for Windows' SDK, prepend <worktree>/bin-wrappers to the PATH.

  • Alternatively, run make install in the Git worktree.

  • If you need to test this in a full installer, run sdk build git-and-installer.

  • You can also "install" Git into an existing portable Git via make install DESTDIR=<dir> where <dir> refers to the top-level directory of the portable Git. In this instance, you will want to prepend that portable Git's /cmd directory to the PATH, or test by running that portable Git's git-bash.exe or git-cmd.exe.

  • If you built using a recent Visual Studio, you can use the menu item Build>Install git (you will want to click on Project>CMake Settings for Git first, then click on Edit JSON and then point installRoot to the mingw64 directory of an already-unpacked portable Git).

    As in the previous bullet point, you will then prepend /cmd to the PATH or run using the portable Git's git-bash.exe or git-cmd.exe.

  • If you want to run the built executables in-place, but in a CMD instead of inside a Bash, you can run a snippet like this in the git-bash.exe window where Git was built (ensure that the EOF line has no leading spaces), and then paste into the CMD window what was put in the clipboard:

    clip.exe <<EOF
    set GIT_EXEC_PATH=$(cygpath -aw .)
    set PATH=$(cygpath -awp ".:contrib/scalar:/mingw64/bin:/usr/bin:$PATH")
    set GIT_TEMPLATE_DIR=$(cygpath -aw templates/blt)
    set GITPERLLIB=$(cygpath -aw perl/build/lib)
    EOF
    
  • If you want to run the built executables in-place, but outside of Git for Windows' SDK, and without an option to set/override any environment variables (e.g. in Visual Studio's debugger), you can call the Git executable by its absolute path and use the --exec-path option, like so:

    C:\git-sdk-64\usr\src\git\git.exe --exec-path=C:\git-sdk-64\usr\src\git help
    

    Note: for this to work, you have to hard-link (or copy) the .dll files from the /mingw64/bin directory to the Git worktree, or add the /mingw64/bin directory to the PATH somehow or other.

To make sure that you are testing the correct binary, call ./git.exe version in the Git worktree, and then call git version in a directory/window where you want to test Git, and verify that they refer to the same version (you may even want to pass the command-line option --build-options to look at the exact commit from which the Git version was built).

Git - fast, scalable, distributed revision control system

Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.

Git is an Open Source project covered by the GNU General Public License version 2 (some parts of it are under different licenses, compatible with the GPLv2). It was originally written by Linus Torvalds with help of a group of hackers around the net.

Please read the file INSTALL for installation instructions.

Many Git online resources are accessible from https://git-scm.com/ including full documentation and Git related tools.

See Documentation/gittutorial.adoc to get started, then see Documentation/giteveryday.adoc for a useful minimum set of commands, and Documentation/git-<commandname>.adoc for documentation of each command. If git has been correctly installed, then the tutorial can also be read with man gittutorial or git help tutorial, and the documentation of each command with man git-<commandname> or git help <commandname>.

CVS users may also want to read Documentation/gitcvs-migration.adoc (man gitcvs-migration or git help cvs-migration if git is installed).

The user discussion and development of core Git take place on the Git mailing list -- everyone is welcome to post bug reports, feature requests, comments and patches to git@vger.kernel.org (read Documentation/SubmittingPatches for instructions on patch submission and Documentation/CodingGuidelines).

Those wishing to help with error message, usage and informational message string translations (localization l10) should see po/README.md (a po file is a Portable Object file that holds the translations).

To subscribe to the list, send an email to git+subscribe@vger.kernel.org (see https://subspace.kernel.org/subscribing.html for details). The mailing list archives are available at https://lore.kernel.org/git/, https://marc.info/?l=git and other archival sites. The core git mailing list is plain text (no HTML!).

Issues which are security relevant should be disclosed privately to the Git Security mailing list git-security@googlegroups.com.

The maintainer frequently sends the "What's cooking" reports that list the current status of various development topics to the mailing list. The discussion following them give a good reference for project status, development direction and remaining tasks.

The name "git" was given by Linus Torvalds when he wrote the very first version. He described the tool as "the stupid content tracker" and the name as (depending on your mood):

  • random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of "get" may or may not be relevant.
  • stupid. contemptible and despicable. simple. Take your pick from the dictionary of slang.
  • "global information tracker": you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.
  • "goddamn idiotic truckload of sh*t": when it breaks
Description
A fork of Git containing Windows-specific patches.
Readme 424 MiB
2025-08-19 03:50:05 -05:00
Languages
C 50.6%
Shell 38.7%
Perl 4.3%
Tcl 3.1%
Python 0.8%
Other 2.3%