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

Re: [PATCH v2 4/9] object: add clear_commit_marks_all()

From
Jeff King <peff@peff.net>
Date
Jan 12, 2018, 15:20 UTC
Message-ID
<20180112152058.GA10210@sigill.intra.peff.net>
In-Reply-To
<a0ca86b8-e258-2588-1c99-a30e8e60fdbd@web.de>
On Thu, Jan 11, 2018 at 07:57:42PM +0100, René Scharfe wrote:
Show 13 quoted lines
> > Is it worth having:
> > 
> >    void clear_object_flags_from_type(int type, unsigned flags);
> > 
> > rather than having two near-identical functions? I guess we'd need some
> > way of saying "all types" to reimplement clear_object_flags() as a
> > wrapper (OBJ_NONE, I guess?).
> 
> I don't know if there is a demand.  Perhaps the two callers of
> clear_object_flags() should be switched to clear_commit_marks_all()?
> They look like they only care about commits as well.  Or is it safe to
> stomp over the flags of objects of other types?  Then we'd only need
> to keep clear_object_flags()..

I'd worry that the call in reset_revision_walk() might want to clear non-commits if the revisions have "--objects" passed to them.

I do suspect that clearing flags from all objects would just work in the general case (since we're limiting ourselves to only a particular set of flags). But it's probably not worth the risk of unintended fallout, since there's not much benefit after your series.

Show 15 quoted lines
> > The run-time check is maybe a little bit slower in the middle of a tight
> > loop, but I'm not sure it would matter much (I'd actually be curious if
> > this approach is faster than the existing traversal code, too).
> 
> I don't know how to measure this properly.  With 100 runs each I get
> this for the git repo and the silly test program below, which measures
> the duration of the respective function call:
> 
>    mean        stddev method
>    ----------- ------ ----------------------
>    5.89763e+06 613106 clear_commit_marks
>    2.72572e+06 507689 clear_commit_marks_all
>    1.96582e+06 494753 clear_object_flags
> 
> So these are noisy numbers, but kind of in the expected range.

That's about what I'd expect. The "bad" case for looking at all objects is when there are a bunch of objects loaded that _weren't_ part of this particular traversal. I have no idea how often that happens, but we can guess at the impact in the worst case: having done a previous --objects traversal in the process and then traversing all of the commits a second time, we'd probably have about 5-10x as many objects to look through for that second path. So clear_commit_marks() would win there.

The absolute numbers are small enough that it probably doesn't matter either way.

-Peff
Previous: René ScharfeNext: René Scharfe
Message 19 of 32 in “revision: introduce prepare_revision_walk_extended()”
  1. revision: introduce prepare_revision_walk_extended()René Scharfe, Dec 16, 2017
  2. Martin ÅgrenDec 17, 2017
  3. Jeff KingDec 18, 2017
  4. René ScharfeDec 18, 2017
  5. Jeff KingDec 19, 2017
  6. Junio C HamanoDec 19, 2017
  7. Jeff KingDec 20, 2017
  8. René ScharfeDec 21, 2017
  9. Jeff KingDec 24, 2017
  10. René ScharfeDec 25, 2017
  11. 0/9 revision: get rid of the flag leak_pendingRené Scharfe, Dec 25, 2017
  12. 1/9 commit: avoid allocation in clear_commit_marks_many()René Scharfe, Dec 25, 2017
  13. Jeff KingJan 10, 2018
  14. 2/9 commit: use clear_commit_marks_many() in remove_redundant()René Scharfe, Dec 25, 2017
  15. 3/9 ref-filter: use clear_commit_marks_many() in do_merge_filter()René Scharfe, Dec 25, 2017
  16. 4/9 object: add clear_commit_marks_all()René Scharfe, Dec 25, 2017
  17. Jeff KingJan 10, 2018
  18. René ScharfeJan 11, 2018
  19. Jeff KingJan 12, 2018
  20. 5/9 bisect: avoid using the rev_info flag leak_pendingRené Scharfe, Dec 25, 2017
  21. Jeff KingJan 10, 2018
  22. René ScharfeJan 11, 2018
  23. Jeff KingJan 12, 2018
  24. 6/9 bundle: avoid using the rev_info flag leak_pendingRené Scharfe, Dec 25, 2017
  25. Junio C HamanoDec 28, 2017
  26. Jeff KingJan 10, 2018
  27. 7/9 checkout: avoid using the rev_info flag leak_pendingRené Scharfe, Dec 25, 2017
  28. Junio C HamanoDec 28, 2017
  29. 8/9 revision: remove the unused flag leak_pendingRené Scharfe, Dec 25, 2017
  30. 9/9 commit: remove unused function clear_commit_marks_for_object_array()René Scharfe, Dec 25, 2017
  31. Junio C HamanoDec 28, 2017
  32. Jeff KingJan 10, 2018

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.