Shawn Pearce <spearce@xxxxxxxxxxx> wrote: > Junio C Hamano <junkio@xxxxxxx> wrote: > > > > Also I wonder how much complexity would we suffer and how much > > efficiency would we gain if we binary search the logdata (the > > committer info is variable length, so you would need to resync > > in each step). > > I thought about doing this but did not think it would be worth the > effort (either developer to code or CPU to execute) at this point > in time. I don't think users will be pulling refs from the log very > often and if they are they will probably be pulling from recent time, > not very far back. Thus starting at the end and walking back is > probably "good enough". > > But if it proves to be too slow in practice I'm sure I can come up > with a faster way to walk through the log. :-) I just ran a test on my PowerBook: walking a 10,000 line log file and extracting the very oldest commit along. Each hit on git-rev-parse seems to took about 100 ms. Hardly worth worrying about for casual use. Further git-rev-parse is taking 73 ms just to run '--verify HEAD' so an extra 30 ms to read the 10k log is pretty much nothing. [spearce@pb15 trash]$ wc -l .git/logs/refs/heads/master 10000 .git/logs/refs/heads/master [spearce@pb15 trash]$ head -n 1 .git/logs/refs/heads/master b943559a305bdd6bdee2cef6e5df2413c3d30a00 0000000000000000000000000000000000000000 A U Thor <example@xxxxxxxxxxx> 1136091600 -0500 [spearce@pb15 trash]$ perl -e 'print scalar(localtime shift),"\n"' 1136091600 Sun Jan 1 00:00:00 2006 [spearce@pb15 trash]$ time ../../git-rev-parse --verify HEAD@'300 days' warning: Log .git/logs/refs/heads/master only goes back to Thu, 1 Jan 1970 00:00:00 +0000. b943559a305bdd6bdee2cef6e5df2413c3d30a00 real 0m0.112s user 0m0.029s sys 0m0.023s [spearce@pb15 trash]$ time ../../git-rev-parse --verify HEAD@'300 days' warning: Log .git/logs/refs/heads/master only goes back to Thu, 1 Jan 1970 00:00:00 +0000. b943559a305bdd6bdee2cef6e5df2413c3d30a00 real 0m0.105s user 0m0.029s sys 0m0.023s -- Shawn. - : 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