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

[PATCH 0/3] read-cache: use stack ondisk struct when writing index

From
KWKevin Willford <kewillf@microsoft.com>
Date
Aug 21, 2017, 21:24 UTC
Message-ID
<20170821212432.47364-1-kewillf@microsoft.com>

When writing out the index, the ondisk struct was being allocated and freed within the loop of cache entries. A better way would be to use a ondisk struct on the stack and reuse it avoiding the alloc and free calls.

A test has been added to measure the performance of writing the index (p0007-write-cache). Running this test on smaller repos showed no degradation in performance. On larger repos there was ~3-7% improvement.

0007.2: write_locked_index 10 times (1000001 files) 5.98(0.00+0.04) 5.75(0.01+0.04) -3.8% 0007.2: write_locked_index 10 times (1000001 files) 6.20(0.00+0.06) 5.86(0.01+0.03) -5.5% 0007.2: write_locked_index 3 times (4394531 files) 10.29(0.04+0.03) 9.75(0.04+0.01) -5.2% 0007.2: write_locked_index 3 times (4394531 files) 10.52(0.00+0.04) 9.79(0.03+0.03) -6.9%

Kevin Willford (3):
  perf: add test for writing the index
  read-cache: fix memory leak in do_write_index
  read-cache: avoid allocating every ondisk entry when writing
 Makefile                    |  1 +
 read-cache.c                | 62 +++++++++++++++++++++++++--------------------
 t/helper/test-write-cache.c | 23 +++++++++++++++++
 t/perf/p0007-write-cache.sh | 29 +++++++++++++++++++++
 4 files changed, 87 insertions(+), 28 deletions(-)
 create mode 100644 t/helper/test-write-cache.c
 create mode 100755 t/perf/p0007-write-cache.sh
-- 
2.14.1.205.g2812f3410d
Next: Kevin Willford
Message 1 of 6 in “read-cache: use stack ondisk struct when writing index”
  1. 0/3 read-cache: use stack ondisk struct when writing indexKevin Willford, Aug 21, 2017
  2. 1/3 perf: add test for writing the indexKevin Willford, Aug 21, 2017
  3. 2/3 read-cache: fix memory leak in do_write_indexKevin Willford, Aug 21, 2017
  4. Junio C HamanoAug 21, 2017
  5. 3/3 read-cache: avoid allocating every ondisk entry when writingKevin Willford, Aug 21, 2017
  6. Junio C HamanoAug 21, 2017

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.