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

Re: [PATCH v2 1/3] Eliminate recursion in setting/clearing marks in commit list

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 9, 2012, 22:09 UTC
Message-ID
<7v4nw4edeu.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1326081546-29320-2-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
Show 6 quoted lines
> Recursion in a DAG is generally a bad idea because it could be very
> deep. Be defensive and avoid recursion in mark_parents_uninteresting()
> and clear_commit_marks().
>
> mark_parents_uninteresting() learns a trick from clear_commit_marks()
> to avoid malloc() in (dorminant) single-parent case.
Looks cleanly done.

This retains the depth-firstness of the (supposedly less common case) recursion in mark_parents_uninteresting() from the original code, by adding the already parsed parent at the beginning of the queue. I suspect that the original went depth-first primarily because that was the most straightforward way to code it, but now you have more flexibility, I wonder if there is a difference if we made it width-first, and if so, if the difference is positive or detrimental.

Thanks.
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 13 of 21 in “Eliminate recursion in setting/clearing marks in commit list”
  1. 1/3 Eliminate recursion in setting/clearing marks in commit listNguyễn Thái Ngọc Duy, Dec 26, 2011
  2. 2/3 index-pack: eliminate recursion in find_unresolved_deltasNguyễn Thái Ngọc Duy, Dec 26, 2011
  3. 3/3 index-pack: eliminate unlimited recursion in get_delta_base()Nguyễn Thái Ngọc Duy, Dec 26, 2011
  4. 0/3 nd/index-pack-no-recurseNguyễn Thái Ngọc Duy, Jan 9, 2012
  5. Junio C HamanoJan 9, 2012
  6. 0/3 nd/index-pack-no-recurseNguyễn Thái Ngọc Duy, Jan 14, 2012
  7. 1/3 Eliminate recursion in setting/clearing marks in commit listNguyễn Thái Ngọc Duy, Jan 14, 2012
  8. Peter BaumannJan 14, 2012
  9. Nguyen Thai Ngoc DuyJan 15, 2012
  10. 2/3 index-pack: eliminate recursion in find_unresolved_deltasNguyễn Thái Ngọc Duy, Jan 14, 2012
  11. 3/3 index-pack: eliminate unlimited recursion in get_base_data()Nguyễn Thái Ngọc Duy, Jan 14, 2012
  12. 1/3 Eliminate recursion in setting/clearing marks in commit listNguyễn Thái Ngọc Duy, Jan 9, 2012
  13. Junio C HamanoJan 9, 2012
  14. 2/3 index-pack: eliminate recursion in find_unresolved_deltasNguyễn Thái Ngọc Duy, Jan 9, 2012
  15. Junio C HamanoJan 9, 2012
  16. Nguyen Thai Ngoc DuyJan 10, 2012
  17. Junio C HamanoJan 12, 2012
  18. 3/3 index-pack: eliminate unlimited recursion in get_delta_base()Nguyễn Thái Ngọc Duy, Jan 9, 2012
  19. Junio C HamanoJan 9, 2012
  20. Nguyen Thai Ngoc DuyJan 10, 2012
  21. Nguyen Thai Ngoc DuyJan 10, 2012

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.