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

Re: Make the git codebase thread-safe

From
David Kastrup <dak@gnu.org>
Date
Apr 2, 2019, 10:30 UTC
Message-ID
<87lg0s66nm.fsf@fencepost.gnu.org>
In-Reply-To
<CACsJy8BSDz1JO+w1N9w2W1zxY+EWTxiU6yB_V0eeOD--g-TzeA@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 14 quoted lines
> On Tue, Apr 2, 2019 at 7:52 AM Matheus Tavares
> <matheus.bernardino@usp.br> wrote:
>> I downloaded chromium to give it a try and got (on a machine with i7 and
>> SSD, running Manjaro Linux):
>>
>> - 17s on blame for a file with long history[2]
>> - 2m on blame for a huge file[3]
>> - 15s on log for both [2] and [3]
>> - 1s for git status
>>
>> It seems quite a lot, especially with SSD, IMO.
>
> There have been a couple of optimizations that are probably still not
> enabled by default because they only benefit large repos.

I've proposed a trivial change in 2014 that could have cut down typical blame times significantly but nobody was interested in testing and committing it, and it is conceivable that in limited-memory situations it might warrant some accounting/mitigation for weird histories (not that there isn't other code like that).

Rebased/appended.
-- 
David Kastrup


From a076daf13d144cb74ae5fd7250445bbfb4669a05 Mon Sep 17 00:00:00 2001
From: David Kastrup <dak@gnu.org>
Date: Sun, 2 Feb 2014 18:33:35 +0100
Subject: [PATCH] blame.c: don't drop origin blobs as eagerly

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.
---
 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
Previous: Duy NguyenNext: Duy Nguyen
Message 42 of 55 in “Make the git codebase thread-safe”
  1. Stefan ZagerFeb 12, 2014
  2. Robin H. JohnsonFeb 12, 2014
  3. Duy NguyenFeb 12, 2014
  4. Karsten BleesFeb 12, 2014
  5. Mike HommeyFeb 12, 2014
  6. Karsten BleesFeb 13, 2014
  7. Stefan ZagerFeb 12, 2014
  8. Duy NguyenFeb 12, 2014
  9. Stefan ZagerFeb 12, 2014
  10. Matthieu MoyFeb 12, 2014
  11. Stefan ZagerFeb 12, 2014
  12. David KastrupFeb 12, 2014
  13. Stefan ZagerFeb 12, 2014
  14. David KastrupFeb 12, 2014
  15. Mike HommeyFeb 12, 2014
  16. David KastrupFeb 13, 2014
  17. Mike HommeyFeb 13, 2014
  18. Mike HommeyFeb 13, 2014
  19. David KastrupFeb 13, 2014
  20. Junio C HamanoFeb 12, 2014
  21. Stefan ZagerFeb 12, 2014
  22. Junio C HamanoFeb 12, 2014
  23. Erik Faye-LundFeb 12, 2014
  24. Stefan ZagerFeb 12, 2014
  25. Erik Faye-LundFeb 12, 2014
  26. Stefan ZagerFeb 12, 2014
  27. Erik Faye-LundFeb 12, 2014
  28. Karsten BleesFeb 12, 2014
  29. Stefan ZagerFeb 12, 2014
  30. Johannes SixtFeb 13, 2014
  31. David KastrupFeb 13, 2014
  32. Stefan ZagerFeb 13, 2014
  33. Zachary TurnerFeb 13, 2014
  34. Karsten BleesFeb 13, 2014
  35. Stefan ZagerFeb 13, 2014
  36. Zachary TurnerFeb 13, 2014
  37. Karsten BleesFeb 14, 2014
  38. Stefan ZagerFeb 14, 2014
  39. brian m. carlsonFeb 13, 2014
  40. Matheus TavaresApr 2, 2019
  41. Duy NguyenApr 2, 2019
  42. David KastrupApr 2, 2019
  43. Duy NguyenApr 2, 2019
  44. David KastrupApr 2, 2019
  45. Matheus Tavares BernardinoApr 2, 2019
  46. Zachary TurnerFeb 14, 2014
  47. Karsten BleesFeb 14, 2014
  48. Duy NguyenFeb 15, 2014
  49. Stefan ZagerFeb 15, 2014
  50. Duy NguyenFeb 15, 2014
  51. Zachary TurnerFeb 15, 2014
  52. Duy NguyenFeb 15, 2014
  53. Junio C HamanoFeb 18, 2014
  54. Zachary TurnerFeb 18, 2014
  55. Stefan ZagerFeb 14, 2014

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.