git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Randal L. Schwartz
Message 11 of 11 in “git-log to go forward instead of reverse?”
  1. Randal L. SchwartzJul 10, 2006
  2. Linus TorvaldsJul 10, 2006
  3. Randal L. SchwartzJul 10, 2006
  4. Linus TorvaldsJul 10, 2006
  5. Randal L. SchwartzJul 10, 2006
  6. Linus TorvaldsJul 10, 2006
  7. Randal L. SchwartzJul 10, 2006
  8. Junio C HamanoJul 10, 2006
  9. Junio C HamanoJul 10, 2006
  10. Randal L. SchwartzJul 10, 2006
  11. Linus TorvaldsJul 10, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.