Skip to content

read-cache: use stack ondisk struct when writing index

Kevin Willford git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3perf: add test for writing the indexMakefile t/helper/test-write-cache.c t/perf/p0007-write-cache.sh+53 -00 replies
2/3read-cache: fix memory leak in do_write_indexread-cache.c+9 -31 reply
3/3read-cache: avoid allocating every ondisk entry when writingread-cache.c+25 -251 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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

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
Signature · 1 line
2.14.1.205.g2812f3410d