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

[PATCH] blame.c: don't drop origin blobs as eagerly

From
David Kastrup <dak@gnu.org>
Date
May 27, 2016, 13:35 UTC
Message-ID
<1464356141-3797-1-git-send-email-dak@gnu.org>

When a parent blob already has chunks queued up for blaming, dropping the blob at the end of one blame step will cause it to get reloaded right away, doubling the amount of I/O and unpacking when processing a linear history.

Keeping such parent blobs in memory seems like a reasonable
optimization.  It's conceivable that this may incur additional memory
pressure particularly when the history contains lots of merges from
long-diverged branches.  In practice, this optimization appears to
behave quite benignly, and a viable strategy for limiting the total
amount of cached blobs in a useful manner seems rather hard to
implement.  In addition, calling git-blame with -C leads to similar
memory retention patterns.
---
 builtin/blame.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/builtin/blame.c b/builtin/blame.c
index 21f42b0..2596fbc 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -1556,7 +1556,8 @@ finish:
 	}
 	for (i = 0; i < num_sg; i++) {
 		if (sg_origin[i]) {
-			drop_origin_blob(sg_origin[i]);
+			if (!sg_origin[i]->suspects)
+				drop_origin_blob(sg_origin[i]);
 			origin_decref(sg_origin[i]);
 		}
 	}
-- 
2.7.4
Next: Johannes Schindelin
Message 1 of 7 in “blame.c: don't drop origin blobs as eagerly”
  1. blame.c: don't drop origin blobs as eagerlyDavid Kastrup, May 27, 2016
  2. Johannes SchindelinMay 27, 2016
  3. David KastrupMay 27, 2016
  4. Johannes SchindelinMay 28, 2016
  5. David KastrupMay 28, 2016
  6. Johannes SchindelinMay 28, 2016
  7. David KastrupMay 28, 2016

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.