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

Re: [PATCH] Add --show-size to git log to print message size

From
MCMarco Costalba <mcostalba@gmail.com>
Date
Jul 14, 2007, 20:46 UTC
Message-ID
<e5bfff550707141346q2eba4ab8ka1c85e8b5a2c1b1d@mail.gmail.com>
In-Reply-To
<7vodiehko7.fsf@assigned-by-dhcp.cox.net>
On 7/14/07, Junio C Hamano <gitster@pobox.com> wrote:
Show 8 quoted lines
>
> "size" is a bit vague here.  What if we later want to extend
> things so that you can ask for the entire log entry size
> including the patch output part (I am not saying that would be
> an easy change --- I am more worried about the stability of the
> external interface).  So is --show-"size".  "message-size" would
> have been a bit easier to swallow, but I sense the problem runs
> deeper.
What about --section-sizes?

You can add in the output line all the sizes you want, message, patch and future extensions separated by a space. An example output for message and patch sizes.

sizes 456 565\n

Or, as a stream friendly alternative (and also more elegant) you can output 'section size' before each section, so as example

commit d9e940.... section size 456 < log header and message body> section size 565 <patch diff content> section size 232 <other type of content>

> I have a more basic question. If you are reading from non "-p"
> output, where do you exactly have the wasted cycles in your
> reader's processing?
qgit loading works like this:

git log output is read as a series of big binary chunks by a Qt library function that calls read(), these chunks are read each one in a different buffer and there they stay for all the application life time (or until a data refresh), so there is no copy of data in qgit, the buffers are allocated and the pointers passed to read(), that's all.

It's a kind of software DMA ;-)

The only information that qgit needs to infere at startup is where to find the first line of each commit, for parent information and revision's counting, all the other data is read and consumed only on demand, i.e. for showing to user, but because only the screen visible part of the list is needed, data is read from these buffers and parsed *in small chunks* and only when user scrolls the view.

The problem is that to get the first line of each revision the message boundaries of _all_ the commits must be known/found.

Because currently there is no message size information the application have to:

-get the offset of commit first line -try to find the delimiting '\0' if existing (binary chunks could be truncated at any point) -get the offset of commit first line of next revision -and so on for all the revisions

Finding the delimiting '\0' it means to loop across the whole buffers and _this_ is the expensive and not needed part. If just after the first line would be possible to point to the beginning of the next revision this seeking for '\0' would be not necessary anymore.

When user asks for data of revision 'x' then because offset of revision 'x' is known, application could just point to the correct offset in the correct data buffer and parse out the (small) needed info.

Hope I have explained clearly enough, I have some problems writing in at late evening ;-)

Marco
Previous: Junio C HamanoNext: Alex Riesen
Message 3 of 29 in “Add --show-size to git log to print message size”
  1. Add --show-size to git log to print message sizeMarco Costalba, Jul 14, 2007
  2. Junio C HamanoJul 14, 2007
  3. Marco CostalbaJul 14, 2007
  4. Alex RiesenJul 15, 2007
  5. Marco CostalbaJul 15, 2007
  6. Alex RiesenJul 15, 2007
  7. Marco CostalbaJul 15, 2007
  8. Marco CostalbaJul 15, 2007
  9. SeanJul 15, 2007
  10. Marco CostalbaJul 15, 2007
  11. SeanJul 15, 2007
  12. Marco CostalbaJul 15, 2007
  13. SeanJul 15, 2007
  14. Marco CostalbaJul 15, 2007
  15. SeanJul 15, 2007
  16. Marco CostalbaJul 15, 2007
  17. Linus TorvaldsJul 15, 2007
  18. Marco CostalbaJul 15, 2007
  19. Marco CostalbaJul 16, 2007
  20. Alex RiesenJul 16, 2007
  21. Junio C HamanoJul 16, 2007
  22. Marco CostalbaJul 16, 2007
  23. Marco CostalbaJul 16, 2007
  24. Junio C HamanoJul 16, 2007
  25. Marco CostalbaJul 16, 2007
  26. Andy ParkinsJul 17, 2007
  27. Marco CostalbaJul 17, 2007
  28. Junio C HamanoJul 25, 2007
  29. Marco CostalbaJul 25, 2007

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.