git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] read-cache: use stack ondisk struct when writing index
@ 2017-08-21 21:24 Kevin Willford
  2017-08-21 21:24 ` [PATCH 1/3] perf: add test for writing the index Kevin Willford
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Kevin Willford @ 2017-08-21 21:24 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, peartben, Kevin Willford

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-08-21 23:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-21 21:24 [PATCH 0/3] read-cache: use stack ondisk struct when writing index Kevin Willford
2017-08-21 21:24 ` [PATCH 1/3] perf: add test for writing the index Kevin Willford
2017-08-21 21:24 ` [PATCH 2/3] read-cache: fix memory leak in do_write_index Kevin Willford
2017-08-21 23:02   ` Junio C Hamano
2017-08-21 21:24 ` [PATCH 3/3] read-cache: avoid allocating every ondisk entry when writing Kevin Willford
2017-08-21 23:42   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).