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

Re: how to speed up "git log"?

From
BHBruno Haible <bruno@clisp.org>
Date
Feb 12, 2007, 02:02 UTC
Message-ID
<200702120302.00576.bruno@clisp.org>
In-Reply-To
<200702120059.17676.robin.rosenberg.lists@dewire.com>
Thanks for the responses.
Robin Rosenberg wrote:
> Since you know that you are not interested in the whole history, you can limit your scan.
> 
> git log COREUTILS-5_2_1..COREUTILS-6_4 src/tr.c
Thanks, that indeed does the trick: it reduces the time from 33 sec to 11 sec.

To reduce the time even more, and to allow more flexibility among the search criteria (e.g. "I need the commits from date X to date Y, on this file set, from anyone except me"), I would need to connect git to a database. git cannot store all kinds of indices and reverse mappings to allow all kinds of queries; that's really a classical database application area.

Show 6 quoted lines
> > No, it became even worse: git-1.5.0-rc4 is twice as slow as git-1.4.4 for
> > this command:
> >   git-1.4.4: 25 seconds real time, 24 seconds of CPU time (12 user, 12 system)
> >   git-1.5.0: 50 seconds real time, 39 seconds of CPU time (20 user, 19 system)
> 
> Could the UTF-8 stuff have anything to do with this?

Actually, no. Brown paper bag on me for doing benches in different conditions. The timing difference is an effect of the buffer cache / page cache:

  - After the second repetition of the command (i.e. when all files are cached
    in RAM), the timings are
        25 seconds real time, 24 seconds of CPU time (13 user, 11 system)
    both in git-1.4.4 and -1.5.0-rc4.
  - After unmounting and remounting the disk containing the repository (i.e.
    when none of the files are cached in RAM), the timings are
        49 seconds real time, 38 seconds of CPU time (20 user, 18 system)
Sorry for the false alarm.
Bruno
Previous: Robin RosenbergNext: Johannes Schindelin
Message 9 of 23 in “how to speed up "git log"?”
  1. Bruno HaibleFeb 11, 2007
  2. Johannes SchindelinFeb 11, 2007
  3. Shawn O. PearceFeb 11, 2007
  4. Johannes SchindelinFeb 11, 2007
  5. Bruno HaibleFeb 11, 2007
  6. Shawn O. PearceFeb 11, 2007
  7. Johannes SchindelinFeb 11, 2007
  8. Robin RosenbergFeb 11, 2007
  9. Bruno HaibleFeb 12, 2007
  10. Johannes SchindelinFeb 12, 2007
  11. Junio C HamanoFeb 12, 2007
  12. Shawn O. PearceFeb 12, 2007
  13. Junio C HamanoFeb 12, 2007
  14. Shawn O. PearceFeb 12, 2007
  15. Shawn O. PearceFeb 12, 2007
  16. Linus TorvaldsFeb 12, 2007
  17. Bruno HaibleFeb 12, 2007
  18. Bruno HaibleFeb 11, 2007
  19. Bruno HaibleFeb 17, 2007
  20. Johannes SchindelinFeb 17, 2007
  21. Bruno HaibleFeb 18, 2007
  22. Johannes SchindelinFeb 18, 2007
  23. Shawn O. PearceFeb 18, 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.