{"thread":{"id":"66764","subject":"bugreport: performance regression on git log --follow","startedAt":"2026-11-04T07:58:25Z","lastAt":"2026-11-04T15:56:25Z","messageCount":2,"participants":["b.murauer@posteo.de","Patrick Steinhardt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"557410","messageId":"1491d49cdb1a96698e5572d9de3ac280@posteo.de","threadId":"66764","inReplyTo":null,"subject":"bugreport: performance regression on git log --follow","fromName":"","fromEmail":"b.murauer@posteo.de","sentAt":"2026-11-04T07:58:25Z","receivedAt":"2026-11-04T07:58:25Z","isPatch":false,"sender":{"key":"b.murauer@posteo.de","avatar":null},"body":"Thank you for filling out a Git bug report!\nPlease answer the following questions to help us understand your issue.\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\n\nI ran git log --follow on a single file in a repository with about 30k commits\nand 27k tracked files:\n\n    git log --follow --oneline -- path/to/file.ts >/dev/null\n\nVS Code's Timeline view runs a similar command automatically:\n\n    git log --no-ext-diff --no-textconv --format=<format> -z -n551 --shortstat \\\n        --follow -- path/to/file.ts\n\nWe regularly merge older maintenance branches forward into main. The affected\nfile was added on main and does not exist on those branches, so many merges have\na parent that lacks it. The following command reports 692 commits for this file:\n\n    git log --full-history -m --diff-filter=A --format=%h -- path/to/file.ts |\n        sort -u | wc -l\n\nWhat did you expect to happen? (Expected behavior)\n\nI expected the command to finish in a time comparable to earlier Git versions.\nWith Git 2.43 on the same history, it takes about 1 second.\n\nWhat happened instead? (Actual behavior)\n\nWith Git 2.56, the command takes around 10 minutes. It uses one CPU core\nfor the whole run, with very little system time, and output appears slowly.\n\nBisecting between v2.43.0 and v2.56.0 identified this commit:\n\n    304812ed33 (log: improve --follow following renames for non-linear history)\n\nWhat's different between what you expected and what actually happened?\n\nThe command is around 600 times slower than with Git 2.43 and is effectively\nunusable for this file. The output of the newer version may also legitimately\ndiffer on non-linear history, but the slowdown is the problem being reported.\n\nAnything else you want to add:\n\nperf report for a 20-second sample with Git 2.56:\n\n    24.67%  hash_chars\n    10.37%  spanhash_cmp\n     9.91%  0x0000000000043558\n     4.90%  zng_inflate\n     2.89%  bsearch_hash\n     1.86%  dowild\n     1.45%  diffcore_count_changes\n\nThis points to rename detection. My understanding is that the commit now runs a\nfollow-enabled diff against each parent of a merge. If that parent lacks the\nfile, Git looks for a rename source across that parent's tree. This happens at\nevery such merge, so the cost grows with the number of forward merges and the\nsize of the tree.\n\nThings I ruled out:\n- The repository is a full clone, not shallow or partial, with no missing objects.\n- It is freshly packed: 0 loose objects, 2 packs, about 1.37M objects, 543 MiB.\n- Disabling the commit-graph with core.commitGraph=false does not help.\n- Ignoring global and system config does not help.\n- Git LFS is not involved: GIT_TRACE shows no external processes being launched.\n- Setting diff.renameLimit=1 does not fix it: the command still takes over a minute.\n\nI have a bash script that reproduces the issue, if needed. I'm not sure if\nsuch things should be shared via this channel.\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n[System Info]\ngit version:\ngit version 2.56.0\ncpu: x86_64\nbuilt from commit: a018953688f1b10bddf91bff8747068f5f4746a4\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nrust: enabled\nfeature: fsmonitor--daemon\ngettext: enabled\nlibcurl: 8.22.0\nOpenSSL: OpenSSL 3.6.4 25 Aug 2026\nzlib-ng: 2.3.3\nSHA-1: SHA1_DC\nSHA-256: SHA256_BLK\ndefault-ref-format: files\ndefault-hash: sha1\nuname: Linux 7.2.14-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 30 Oct 2026 14:32:40 +0000 x86_64\ncompiler info: gnuc: 16.2\nlibc info: glibc: 2.44\n$SHELL (typically, interactive shell): /usr/bin/fish\n\n\n[Enabled Hooks]\nnot run from a git repository - no hooks to show\n\n"},{"id":"557447","messageId":"autVqTLs_pgwVcSE@pks.im","threadId":"66764","inReplyTo":"1491d49cdb1a96698e5572d9de3ac280@posteo.de","subject":"Re: bugreport: performance regression on git log --follow","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-11-04T15:56:25Z","receivedAt":"2026-11-04T15:56:25Z","isPatch":false,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Nov 04, 2026 at 07:58:25AM +0000, b.murauer@posteo.de wrote:\n> Thank you for filling out a Git bug report!\n> Please answer the following questions to help us understand your issue.\n> \n> What did you do before the bug happened? (Steps to reproduce your issue)\n> \n> I ran git log --follow on a single file in a repository with about 30k\n> commits\n> and 27k tracked files:\n> \n>     git log --follow --oneline -- path/to/file.ts >/dev/null\n> \n> VS Code's Timeline view runs a similar command automatically:\n> \n>     git log --no-ext-diff --no-textconv --format=<format> -z -n551\n> --shortstat \\\n>         --follow -- path/to/file.ts\n> \n> We regularly merge older maintenance branches forward into main. The\n> affected\n> file was added on main and does not exist on those branches, so many merges\n> have\n> a parent that lacks it. The following command reports 692 commits for this\n> file:\n> \n>     git log --full-history -m --diff-filter=A --format=%h -- path/to/file.ts\n> |\n>         sort -u | wc -l\n> \n> What did you expect to happen? (Expected behavior)\n> \n> I expected the command to finish in a time comparable to earlier Git\n> versions.\n> With Git 2.43 on the same history, it takes about 1 second.\n> \n> What happened instead? (Actual behavior)\n> \n> With Git 2.56, the command takes around 10 minutes. It uses one CPU core\n> for the whole run, with very little system time, and output appears slowly.\n\nThanks for your report! This is a known issue which was originally\nreported at [1]. That thread also has some patches that are currently in\nreview.\n\nPatrick\n\n[1]: https://lore.kernel.org/git/as44NVKZA9C9S5ae@pks.im/\n\n"}]}