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

Re: Performance issue of 'git branch'

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 23, 2009, 05:52 UTC
Message-ID
<7veis83q0e.fsf@alter.siamese.dyndns.org>
In-Reply-To
<alpine.LFD.2.01.0907222204310.21520@localhost.localdomain>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 10 quoted lines
> On Wed, 22 Jul 2009, Junio C Hamano wrote:
>> 
>> Hmm, we now have to remember what this patch did, if we ever wanted to
>> introduce negative refs later (see ef06b91 do_for_each_ref: perform the
>> same sanity check for leftovers., 2006-11-18).  Not exactly nice to spread
>> the codepaths that need to be updated.
> ...
> And since git branch will do something _better_ than the 'has_sha1_file()' 
> check (by virtue of actually looking up the commit), I don't think that 
> part is an issue. So the only issue is the is_null_sha1() thing.
Exactly.

That is_null_sha1() thing was a remnant of your idea to represent deleted ref that has a packed counterpart by storing 0{40} in a loose ref, so that we can implement deletion efficiently.

Since we currently implement deletion by repacking packed refs if the ref has a packed (possibly stale) one, we do not use such a "negative ref", and skipping 0{40} done by the normal (i.e. non-raw) for_each_ref() family is not necessary.

I was inclined to say that, because I never saw anybody complained that deleting refs was too slow, we declare that we would forever stick to the current implementation of ref deletion, and remove the is_null_sha1() check from the do_one_ref() function, even for include-broken case.

But after thinking about it again, I'd say "if null, then skip" should be outside the DO_FOR_EACH_INCLUDE_BROKEN anyway, because the null check is not about brokenness of the ref, but is about a possible future expansion to represent deleted ref with such a "negative ref" entry.

If we remove is_null_sha1() from do_one_ref(), or if we move it out of the "include broken" thing, my "Not exactly nice" comment can be rescinded, as doing the former (i.e. removal of is_null_sha1() check) is a promise that we will never have to worry about negative refs, and doing the latter will still protect callers of do_for_each_rawref() from negative refs if we ever introduce them in some future.

Previous: Linus TorvaldsNext: Junio C Hamano
Message 30 of 73 in “Performance issue of 'git branch'”
  1. Carlos R. MafraJul 22, 2009
  2. Linus TorvaldsJul 23, 2009
  3. Linus TorvaldsJul 23, 2009
  4. Linus TorvaldsJul 23, 2009
  5. Carlos R. MafraJul 23, 2009
  6. Linus TorvaldsJul 23, 2009
  7. Jakub NarebskiJul 23, 2009
  8. Carlos R. MafraJul 23, 2009
  9. Linus TorvaldsJul 23, 2009
  10. Carlos R. MafraJul 23, 2009
  11. Linus TorvaldsJul 23, 2009
  12. Linus TorvaldsJul 23, 2009
  13. Linus TorvaldsJul 23, 2009
  14. Linus TorvaldsJul 23, 2009
  15. Tony FinchJul 23, 2009
  16. Linus TorvaldsJul 23, 2009
  17. Newton-Raphson, was Re: Performance issue of 'git branch'Tony Finch, Jul 23, 2009
  18. Johannes SchindelinJul 23, 2009
  19. Tony FinchJul 23, 2009
  20. Johannes SchindelinJul 24, 2009
  21. Carlos R. MafraJul 23, 2009
  22. Carlos R. MafraJul 23, 2009
  23. Carlos R. MafraJul 23, 2009
  24. Linus TorvaldsJul 23, 2009
  25. Linus TorvaldsJul 23, 2009
  26. Junio C HamanoJul 23, 2009
  27. Carlos R. MafraJul 23, 2009
  28. Junio C HamanoJul 23, 2009
  29. Linus TorvaldsJul 23, 2009
  30. Junio C HamanoJul 23, 2009
  31. Junio C HamanoJul 23, 2009
  32. Linus TorvaldsJul 23, 2009
  33. Carlos R. MafraJul 23, 2009
  34. Linus TorvaldsJul 23, 2009
  35. Carlos R. MafraJul 23, 2009
  36. Linus TorvaldsJul 23, 2009
  37. Linus TorvaldsJul 23, 2009
  38. Carlos R. MafraJul 23, 2009
  39. Linus TorvaldsJul 24, 2009
  40. Linus TorvaldsJul 24, 2009
  41. Linus TorvaldsJul 24, 2009
  42. Linus TorvaldsJul 24, 2009
  43. david@lang.hmJul 24, 2009
  44. Linus TorvaldsJul 24, 2009
  45. david@lang.hmJul 24, 2009
  46. Linus TorvaldsJul 25, 2009
  47. Daniel BarkalowJul 25, 2009
  48. Jeff KingAug 7, 2009
  49. Theodore TsoJul 24, 2009
  50. Shawn O. PearceJul 24, 2009
  51. Junio C HamanoJul 24, 2009
  52. Avi KivityJul 26, 2009
  53. Johannes SchindelinJul 26, 2009
  54. Carlos R. MafraJul 24, 2009
  55. Carlos R. MafraJul 25, 2009
  56. Linus TorvaldsJul 25, 2009
  57. Timo HirvonenJul 25, 2009
  58. Reece DunnJul 25, 2009
  59. Mike HommeyJul 25, 2009
  60. Linus TorvaldsJul 25, 2009
  61. Linus TorvaldsJul 25, 2009
  62. Johannes SchindelinJul 25, 2009
  63. Linus TorvaldsJul 26, 2009
  64. Theodore TsoJul 26, 2009
  65. Mike HommeyJul 26, 2009
  66. Johannes SchindelinJul 26, 2009
  67. demerphqJul 26, 2009
  68. demerphqJul 26, 2009
  69. Carlos R. MafraJul 25, 2009
  70. Anders KaseorgJul 23, 2009
  71. Carlos R. MafraJul 23, 2009
  72. SZEDER GáborJul 23, 2009
  73. Carlos R. MafraJul 23, 2009

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.