Re: Add specialized object allocator
From: Linus Torvalds <torvalds@osdl.org>
Date: 2016-06-15 22:42:30
Subsystem:
the rest · Maintainer:
Linus Torvalds
On Mon, 19 Jun 2006, Linus Torvalds wrote:
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;