On Wed, 2010-06-30 at 17:58 -0700, Shawn O. Pearce wrote: > > I can do this using "git tag --contains <commit-id>", but it's quite > > slow. It takes something like 8-9 seconds. (8.5 seconds of user time, > > 8.6 times of wall clock, to be precise). > > > > I can get the information much faster using "gitk -1 <commit-id>", which > > [...] > > using the built-in native git tools? And if so, why is git tag > > --contains apparently 4 times slower than gitk at performing this task? > > gitk keeps a cache of this stuff in .git/gitk.cache. I'll bet its > pulling from cache here, which is why it snaps so fast. > > Without the cache is expensive, which is what 'git tag --contains' > is doing. The code walks back from each tag tracing along the commit > parent pointers, keeping track of the nearest tag name that can reach > any given commit. When it finds your commit, it stops and outputs. > > Since this stuff can't change unless the refs change, yes, it can be > cached easily. But nobody has done caching for this in Git itself, > only in Tcl for gitk. :-\ I think possibly rev-cache would improve this case. Maybe it could also be used for gitk. Perhaps Nick you might like to say more, and comment on what the outstanding work is to do? Sam -- 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