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

[PATCH 4/6] t/perf: add perf tests for fetches from a bitmapped server

From
Jeff King <peff@peff.net>
Date
Mar 26, 2014, 07:22 UTC
Message-ID
<20140326072247.GD32193@sigill.intra.peff.net>
In-Reply-To
<20140326072215.GA31739@sigill.intra.peff.net>

A server with bitmapped packs can serve a clone very quickly. However, fetches are not necessarily made any faster, because we spend a lot less time in object traversal (which is what bitmaps help with) and more time finding deltas (because we may have to throw out on-disk deltas if the client does not have the other side).

As a first step to making this faster, this patch introduces a new perf script to measure fetches into a repo of various ages from a fully-bitmapped server.

We separately measure the work done by the server (in pack-objects) and that done by the client (in index-pack). Furthermore, we measure the size of the resulting pack.

Breaking it down like this (instead of just doing a regular "git fetch") lets us see how much each side benefits from any changes. And since we know the pack size, if we estimate the network speed, then we can calculate a complete wall-clock time for the operation.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/perf/p5311-pack-bitmaps-fetch.sh | 45 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100755 t/perf/p5311-pack-bitmaps-fetch.sh
diff --git a/t/perf/p5311-pack-bitmaps-fetch.sh b/t/perf/p5311-pack-bitmaps-fetch.sh
new file mode 100755
index 0000000..b045759
--- /dev/null
+++ b/t/perf/p5311-pack-bitmaps-fetch.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+test_description='performance of fetches from bitmapped packs'
+. ./perf-lib.sh
+
+test_perf_default_repo
+
+test_expect_success 'create bitmapped server repo' '
+	git config pack.writebitmaps true &&
+	git config pack.writebitmaphashcache true &&
+	git repack -ad
+'
+
+# simulate a fetch from a repository that last fetched N days ago, for
+# various values of N. We do so by following the first-parent chain,
+# and assume the first entry in the chain that is N days older than the current
+# HEAD is where the HEAD would have been then.
+for days in 1 2 4 8 16 32 64 128; do
+	title=$(printf '%10s' "($days days)")
+	test_expect_success "setup revs from $days days ago" '
+		now=$(git log -1 --format=%ct HEAD) &&
+		then=$(($now - ($days * 86400))) &&
+		tip=$(git rev-list -1 --first-parent --until=$then HEAD) &&
+		{
+			echo HEAD &&
+			echo ^$tip
+		} >revs
+	'
+
+	test_perf "server $title" '
+		git pack-objects --stdout --revs \
+				 --thin --delta-base-offset \
+				 <revs >tmp.pack
+	'
+
+	test_size "size   $title" '
+		wc -c <tmp.pack
+	'
+
+	test_perf "client $title" '
+		git index-pack --stdin --fix-thin <tmp.pack
+	'
+done
+
+test_done
-- 
1.9.1.601.g7ec968e
Previous: Jeff KingNext: Jeff King
Message 6 of 17 in “reuse deltas found by bitmaps”
  1. 0/6 reuse deltas found by bitmapsJeff King, Mar 26, 2014
  2. 1/6 t/perf-lib: factor boilerplate out of test_perfJeff King, Mar 26, 2014
  3. Junio C HamanoMar 26, 2014
  4. 2/6 t/perf/aggregate: factor our percent calculationsJeff King, Mar 26, 2014
  5. 3/6 t/perf: add infrastructure for measuring sizesJeff King, Mar 26, 2014
  6. 4/6 t/perf: add perf tests for fetches from a bitmapped serverJeff King, Mar 26, 2014
  7. 5/6 pack-bitmap: save "have" bitmap from walkJeff King, Mar 26, 2014
  8. 6/6 pack-objects: reuse deltas for thin "have" objectsJeff King, Mar 26, 2014
  9. Eric SunshineMar 28, 2014
  10. Junio C HamanoMar 26, 2014
  11. Jeff KingMar 26, 2014
  12. Junio C HamanoMar 26, 2014
  13. Jeff KingMar 26, 2014
  14. Jeff KingMar 27, 2014
  15. Junio C HamanoMar 27, 2014
  16. Siddharth AgarwalMar 26, 2014
  17. Siddharth AgarwalMar 27, 2014

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.