Ok, this is a two-patch series that first tries to clean things up a bit, and then applies Junio's approach to speed up the reachability test. The reason I did it this way is that I think we can improve on the reachability logic a bit more, but in order to do that I refuse to work with the crazy duplicated complex logic inside 'expire_reflog_ent()', and I wanted to abstract it out. Then, the first cut at speedup is just Junio's approach. Which is fairly hacky, but works. I'd _like_ to do more of a "dynamically do 'mark_reachable()' only when necessary" thing, but that's a separate cleanup thing. As is, this improves the reflog expire quite enormously for me: - before: [torvalds@nehalem linux]$ time git reflog expire --all real 0m37.193s user 0m37.174s sys 0m0.020s - after: [torvalds@nehalem linux]$ time ~/git/git reflog expire --all real 0m1.693s user 0m1.672s sys 0m0.020s although I do suspect that the 'mark_reachable()' could slow things down in some less extreme cases. But probably never by a huge amount. Total diffstat: builtin-reflog.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 69 insertions(+), 6 deletions(-) with the two individual patches coming up next. Linus -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html