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

git slow unless piped to cat

From
Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date
Aug 27, 2019, 08:15 UTC
Message-ID
<20190827081559.mt5wjpdvqzn62dib@pengutronix.de>
Hello,

I have a problem here with git being slow in some situations. Using git 2.23.0 (from Debian) the effect is:

ukl@dude.ptx:/ptx/src/git/linux.git$ sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"; time git show v5.2 tag v5.2 ...

real 0m12.727s user 0m0.300s sys 0m0.371s

But to get the actual data isn't the problem:

ukl@dude.ptx:/ptx/src/git/linux.git$ sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"; time git show v5.2 | cat tag v5.2 ...

real 0m0.764s user 0m0.014s sys 0m0.020s

My expectation is that both commands should take approximately the same amount of time. This is 100% reproducible here.

The backing filesystem could be quicker (don't know, this is xfs in an logical volume) but this applies to both calls, so this doesn't seem to be the biggest culprit at least.

This is not a regression, I see similar problems since >2 years. (Didn't report before because I didn't know such an obvious reproducer.)

Using perf I get in the first case:
   7.99%  git      libz.so.1.2.11      [.] inflate
   3.02%  git      libc-2.28.so        [.] __memcmp_sse4_1
   1.67%  git      [kernel.kallsyms]   [k] __list_del_entry_valid
   1.32%  git      [kernel.kallsyms]   [k] unmap_page_range
   1.25%  git      [kernel.kallsyms]   [k] filemap_map_pages
   ...
while with cat I get:
   3.35%  git      [kernel.kallsyms]  [k] __update_load_avg_cfs_rq
   3.22%  git      [kernel.kallsyms]  [k] update_blocked_averages
   2.37%  git      [kernel.kallsyms]  [k] __list_del_entry_valid
   1.92%  git      [kernel.kallsyms]  [k] hrtimer_interrupt
   1.91%  git      [kernel.kallsyms]  [k] __pagevec_lru_add_fn
It doesn't seem to be related to stdio buffering or coloring as
	stdbuf -o0 git show --no-color v5.2
is slow, too.

Any idea what could be the problem? Is there some info that I might report additionally to make this better understandable?

Best regards Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Next: SZEDER Gábor
Message 1 of 13 in “git slow unless piped to cat”
  1. Uwe Kleine-KönigAug 27, 2019
  2. SZEDER GáborAug 27, 2019
  3. Uwe Kleine-KönigAug 27, 2019
  4. Philipp ZabelAug 27, 2019
  5. SZEDER GáborAug 27, 2019
  6. Uwe Kleine-KönigAug 27, 2019
  7. SZEDER GáborAug 27, 2019
  8. Uwe Kleine-KönigAug 27, 2019
  9. Michal SuchánekAug 27, 2019
  10. Jeff KingAug 27, 2019
  11. Uwe Kleine-KönigAug 27, 2019
  12. Bryan TurnerAug 27, 2019
  13. Uwe Kleine-KönigAug 28, 2019

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.