Skip to content

Commit dd2e50a

Browse files
peffgitster
authored andcommitted
commit-graph: turn off save_commit_buffer
The commit-graph tool may read a lot of commits, but it only cares about parsing their metadata (parents, trees, etc) and doesn't ever show the messages to the user. And so it should not need save_commit_buffer, which is meant for holding onto the object data of parsed commits so that we can show them later. In fact, it's quite harmful to do so. According to massif, the max heap of "git commit-graph write --reachable" in linux.git before/after this patch (removing the commit graph file in between) goes from ~1.1GB to ~270MB. Which isn't surprising, since the difference is about the sum of the uncompressed sizes of all commits in the repository, and this was equivalent to leaking them. This obviously helps if you're under memory pressure, but even without it, things go faster. My before/after times for that command (without massif) went from 12.521s to 11.874s, a speedup of ~5%. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 67fa6aa commit dd2e50a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

builtin/commit-graph.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ int cmd_commit_graph(int argc, const char **argv, const char *prefix)
249249
builtin_commit_graph_usage,
250250
PARSE_OPT_STOP_AT_NON_OPTION);
251251

252+
save_commit_buffer = 0;
253+
252254
if (argc > 0) {
253255
if (!strcmp(argv[0], "read"))
254256
return graph_read(argc, argv);

0 commit comments

Comments
 (0)