Re: [PATCH 03/16] pack-objects: use a faster hash table
flat view
From: Jeff King <hidden>
Date: 2016-06-15 22:57:55
Subsystem:
the rest · Maintainer:
Linus Torvalds
On Tue, Jun 25, 2013 at 10:14:17PM -0400, Jeff King wrote:
So I suspect two things (but as I said, haven't verified):
1. You could speed up pack-objects just by keeping the table half full
rather than 3/4 full.I wasn't able to show any measurable speedup with this. I tried to make as specific a measurement as I could, by adding a "counting only" option like this:
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index fc12df8..a0438d0 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c@@ -2452,6 +2452,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) const char *rp_av[6]; int rp_ac = 0; int rev_list_unpacked = 0, rev_list_all = 0, rev_list_reflog = 0; + int counting_only = 0; struct option pack_objects_options[] = { OPT_SET_INT('q', "quiet", &progress, N_("do not show progress meter"), 0),
@@ -2515,6 +2516,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) N_("pack compression level")), OPT_SET_INT(0, "keep-true-parents", &grafts_replace_parents, N_("do not hide commits by grafts"), 0), + OPT_BOOL(0, "counting-only", &counting_only, + N_("exit after counting objects phase")), OPT_END(), };
@@ -2600,6 +2603,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) for_each_ref(add_ref_tag, NULL); stop_progress(&progress_state); + if (counting_only) + return 0; if (non_empty && !nr_result) return 0; if (nr_result)
and even doing the whole object traversal ahead of time to just focus on the object-entry hash, like this: git rev-list --objects --all >objects.out time git pack-objects --counting-only --stdout <objects.out Tweaking the hash size didn't have any effect, but using Vicent's khash patch actually made it about 5% slower. So I wonder if I'm even measuring the right thing. Vicent, how did you get the timings you showed in the commit message? -Peff