Re: git-log to go forward instead of reverse?
- From
Linus Torvalds <torvalds@osdl.org>
- Date
- Jul 10, 2006, 19:26 UTC
- Message-ID
- <Pine.LNX.4.64.0607101221170.5623@g5.osdl.org>
- In-Reply-To
- <Pine.LNX.4.64.0607101212410.5623@g5.osdl.org>
On Mon, 10 Jul 2006, Linus Torvalds wrote:
Show 6 quoted lines
> > The difference between getting the first screenful in 0.054 seconds versus > it taking 2.218 seconds is quite noticeable, and one of the things I've > actually spent a fair amount of time on is to make sure that the > incremental output case is the _common_ one for all the normal operations > like "git log -p".
Side note: the good news is that even with the reverse generation, if you also generate _diffs_, the diffs will be generated incrementally, so:
// Full "git log" with diffs [torvalds@g5 linux]$ time git log -p drivers/serial > /dev/null
real 0m3.409s user 0m3.360s sys 0m0.052s
// First screenful of reverse git log with diffs [torvalds@g5 linux]$ time git log -p --reverse drivers/serial | head -25 > /dev/null real 0m2.228s user 0m2.216s sys 0m0.012s
// First screenful of regular git log with diffs [torvalds@g5 linux]$ time git log -p drivers/serial | head -25 > /dev/null real 0m0.038s user 0m0.036s sys 0m0.004s
here you can see how the full "git log -p" is obviously more expensive than the full "git log" was (the diff generation adds about a second to the full time), but because the diffs are generated incrementally as they are shown even with "--reverse", the first screenful of the "--reverse" case didn't get any more expensive, because we didn't generate all the diffs up-front, just the ones we needed.
And the first screenfull of the normal case obviously stays really fast, because both history generation _and_ diff generation is all on-the-fly.
Linus