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

Re: Add specialized object allocator

From
Linus Torvalds <torvalds@osdl.org>
Date
Jun 19, 2006, 18:10 UTC
Message-ID
<Pine.LNX.4.64.0606191101380.5498@g5.osdl.org>
In-Reply-To
<Pine.LNX.4.64.0606191028540.5498@g5.osdl.org>
On Mon, 19 Jun 2006, Linus Torvalds wrote:
Show 9 quoted lines
> 
> It also allows us to track some basic statistics about object
> allocations. For example, for the mozilla import, it shows
> object usage as follows:
> 
>      blobs:   627629 (14710 kB)
>      trees:  1119035 (34969 kB)
>    commits:   196423  (8440 kB)
>       tags:     1336    (46 kB)
Btw, this is the trivial additional patch to allow you to say
	git --report rev-list --all --objects > /dev/null
and have it report object allocation usage after the op.

Useful? Probably not. It was useful for me to verify that everything looked ok (and while I knew we had more trees than blobs, it's actually interesting to see how projects differ.

The "git" tree, for example, has more blobs than trees: because it's a fairly flat development tree, a commit that changes more than one file will generate more new blobs than it generates trees.

In contrast, the kernel has about 30% more trees than blobs (but since trees have the extra data/size fields, 30% extra trees take 75% more space than blobs).

The mozilla import has a _lot_ more trees than blobs (80% more trees, and they use up more than twice as much memory). It's probably a pretty deep tree structure and/or they often commit changes to single files deep into the tree).

		Linus
----
diff --git a/git.c b/git.c
index 329ebec..6149499 100644
--- a/git.c
+++ b/git.c
@@ -271,6 +271,10 @@ int main(int argc, const char **argv, ch
 			puts(git_exec_path());
 			exit(0);
 		}
+		if (!strcmp(cmd, "report")) {
+			atexit(alloc_report);
+			continue;
+		}
 		cmd_usage(0, NULL, NULL);
 	}
 	argv[0] = cmd;
Previous: Linus TorvaldsNext: Junio C Hamano
Message 2 of 5 in “Add specialized object allocator”
  1. Linus TorvaldsJun 19, 2006
  2. Linus TorvaldsJun 19, 2006
  3. Junio C HamanoJun 19, 2006
  4. Linus TorvaldsJun 19, 2006
  5. Junio C HamanoJun 19, 2006

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.