git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [ANNOUNCE] git-sizer: compute various size-related metrics for your Git repository

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Mar 18, 2018, 19:06 UTC
Message-ID
<CAMy9T_FNW5ksx-zLJRb48A-Dt4KNikQ9zXmxDshbby40OSLuyw@mail.gmail.com>
In-Reply-To
<20180316212920.GD12333@sigill.intra.peff.net>
On Fri, Mar 16, 2018 at 10:29 PM, Jeff King <peff@peff.net> wrote:
Show 11 quoted lines
> On Fri, Mar 16, 2018 at 09:01:42PM +0100, Ævar Arnfjörð Bjarmason wrote:
>> One thing that can make repositories very pathological is if the ratio
>> of trees to commits is too low.
>>
>> I was dealing with a repo the other day that had several thousand files
>> all in the same root directory, and no subdirectories.
>
> We've definitely run into this problem before (CocoaPods/Specs, for
> example). The metric that would hopefully show this off is "what is the
> tree object with the most entries". Or possibly "what is the average
> number of entries in a tree object".

I find that the best metric for determining this sort of problem is "Overall repository size -> Trees -> Total tree entries". If you have a big directory that is being changed frequently, the *real* problem is that every commit has to rewrite the whole tree, with all of its many entries. So "Total tree entries" (or equivalently, the total tree size) skyrockets. And this means that a history traversal has to *expand* all of those trees again. So a repository that is problematic for this reason will have a very large number of tree entries.

If you want to detect a bad repository layout like this *before* it becomes a problem, then probably something like "average tree entries per commit" might be a good leading indicator of a problem.

Michael
Previous: Jeff KingNext: Johannes Schindelin
Message 4 of 5 in “[ANNOUNCE] git-sizer: compute various size-related metrics for your Git repository”
  1. Michael HaggertyMar 16, 2018
  2. Ævar Arnfjörð BjarmasonMar 16, 2018
  3. Jeff KingMar 16, 2018
  4. Michael HaggertyMar 18, 2018
  5. Johannes SchindelinMar 21, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.