git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] blame.c: don't drop origin blobs as eagerly
@ 2019-04-02 11:56 David Kastrup
  2019-04-03  7:45 ` Junio C Hamano
  0 siblings, 1 reply; 15+ messages in thread
From: David Kastrup @ 2019-04-02 11:56 UTC (permalink / raw)
  To: git; +Cc: David Kastrup

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
that should incur additional memory pressure mostly when processing the
merges from old branches.

Signed-off-by: David Kastrup <dak@gnu.org>
---
 blame.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/blame.c b/blame.c
index 5c07dec190..c11c516921 100644
--- a/blame.c
+++ b/blame.c
@@ -1562,7 +1562,8 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,
 	}
 	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]);
 			blame_origin_decref(sg_origin[i]);
 		}
 	}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [PATCH] blame.c: don't drop origin blobs as eagerly
@ 2016-05-27 13:35 David Kastrup
  2016-05-27 15:00 ` Johannes Schindelin
  0 siblings, 1 reply; 15+ messages in thread
From: David Kastrup @ 2016-05-27 13:35 UTC (permalink / raw)
  To: git; +Cc: David Kastrup

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

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-04-03 12:32 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-02 11:56 [PATCH] blame.c: don't drop origin blobs as eagerly David Kastrup
2019-04-03  7:45 ` Junio C Hamano
2019-04-03  9:32   ` Duy Nguyen
2019-04-03 11:36     ` Jeff King
2019-04-03 12:06       ` Duy Nguyen
2019-04-03 12:19         ` Jeff King
2019-04-03 12:32           ` David Kastrup
2019-04-03 11:08   ` David Kastrup
  -- strict thread matches above, loose matches on Subject: below --
2016-05-27 13:35 David Kastrup
2016-05-27 15:00 ` Johannes Schindelin
2016-05-27 15:41   ` David Kastrup
2016-05-28  6:37     ` Johannes Schindelin
2016-05-28  8:29       ` David Kastrup
2016-05-28 12:34         ` Johannes Schindelin
2016-05-28 14:00           ` David Kastrup

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).