Am 24.12.2017 um 15:22 schrieb Jeff King: > The single-traversal thing I suspect doesn't matter much in practice. In > both cases if we would visit commit X twice, we'd immediately see on the > second visit that it has already been cleared and not do anymore work. Good point. That makes clear_commit_marks_many() less useful than advertised in e895cb5135, though. > Side note: Another question is whether it would simply be faster to > clear the flags for _all_ objects that we've touched in the current > process (we have clear_object_flags() for this already). Then we know > that we touch each one once, and we as a bonus we don't even have to > keep the previous tips. The downsides are: > > - if another traversal in the process looked at many objects, but > our current traversal looked at few, then we would examine more > objects than we need to (albeit with lower cost per object) > > - it's possible there's another traversal in the same process whose > flags we would want to have saved. I suspect such a setup is > broken already, though, unless there's a guarantee that the two > traversals don't overlap. I thought about that nuclear option as well. It might be a good idea for code in cmd_* and similar leaf functions for cleaning up between unrelated stages (e.g. between parts that had been separate external git command calls before). They probably only load potentially interesting objects into memory and don't need to bother much about interactions with other functions. But clear_object_flags() makes me nervous because it clears the flags of all kinds of objects, not just for commits, and I can't easily convince myself that this is safe. Adding a version that checks the object type would be an easy way out. René