From patchwork Tue Oct 8 14:11:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee X-Patchwork-Id: 13826563 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21B791DFE0D for ; Tue, 8 Oct 2024 14:12:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728396737; cv=none; b=Fay8Zfte7NyANfi4wH884tqpcDwzApw3iAeCUnrYtuH+C0advJS3u+njNBXwbx2ecjOVRU7MIoCiyVC7+eUV0lQVjswCxu7hnbMWwkUJ29CwhRDEQaoS/FdATsRrwBjWMZ0no7IO2ZvygEysRpX440f87n1M91QZYsfnz11tYIs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728396737; c=relaxed/simple; bh=gH/98lVyPPiKwu8q/MqA+CPSSvQp8qmW1wOySMXepYw=; h=Message-Id:In-Reply-To:References:From:Date:Subject:Content-Type: MIME-Version:To:Cc; b=llm/FfJ1ITZTDLdjVgg0XlpfkexPl3HU0v4jwZk3u4ZcUMPTEc4lKJx1psw/ydeRShzEmarMt57/FlQbcYOv9KJhEsMV9cES7br/oVpb6Xc6g4dSygXa4nWfGisUtqM2nf7ykmfJpKwncMqYblPSJj5Z6tuLAS18FqrkpYLCzeA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=iasJJ3Jw; arc=none smtp.client-ip=209.85.208.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iasJJ3Jw" Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-5c915308486so478751a12.0 for ; Tue, 08 Oct 2024 07:12:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728396733; x=1729001533; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=ZL33WxIVg/i1aIggp6yQ/0v5qyXw7yClyCM1pjCQmlc=; b=iasJJ3JwK0rJWhTha7moZLx1G7AKBCHMSu8lak9mVettVaA+soNRuid7rmN12HHkil XtdVbTlOhTUO/mPQlAVMzxjI9gg7f6BBJFVseQs8xYlkpEHQ4/Z/+nzwTt/FNdRpAeSd zBsP0+OdVc131FPKjteFjMvL+dRxz6hYAjpIQqEU5IvVbJfPUEhmQZeQCz1scULMlFTg Y/XpDRlGWrVFz2ErxMiG5hX9H8OuOAG2rps5Y16aeT0MS15bwziEpRJarYCymSyEhec6 lYosSdQLn0zOjh/C23Wu6QkFPjKY0ozIHvGo57VabQ2VFG4/HzF7AxQVdcZjgzTFFJwt KGQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728396733; x=1729001533; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZL33WxIVg/i1aIggp6yQ/0v5qyXw7yClyCM1pjCQmlc=; b=JrRnt7HhXVKhB9M4T4hmYSDZXdk4IY0bHiGXxgIjGtBl2ny1zCDL+P7VwYbYlr5bmT DM4O0rlMipxvJr4sRbiXoq+aWTSZh3Rok4LuHTH4SWrTPJR2qmPS83Lo2M7N6cENrCRR P7Ce4TFHySOrOE/LL5/rKGrspTpPXvLka1pSNAK8U9heq8kVDffjmf+QjOIZaBDIwe3q oITKa9olj91lvg9XeT/fzTK0BlSSlJjFb32S1z7LGniQN8aqkI7xo4Qic01P12X7c43J QaHNksH+2UH3cZJSC+f0LoPkrzDnLf6mjtqixigwd3/1Cq2bGy3RzP1nph6qbaNTvVXK onVQ== X-Gm-Message-State: AOJu0YxoSD+Xq9RWn3yVrsBH6XBS784yW9vT4gAt/e64AZ+6QNjvYJjT hPR/B4+Zskj92WHJBY5SyTbnprhhCJ0Ipq1uLvpgHujLv26T1DEaVJxfrw== X-Google-Smtp-Source: AGHT+IHwbTybGZFamT7HdC68JzCSFOMOYCS/cK6FTYdZzc2UCzfObCIW6yTSU8CP3sb1M+nDzC0tEA== X-Received: by 2002:a05:6402:520b:b0:5c2:439d:2042 with SMTP id 4fb4d7f45d1cf-5c8d2dfbf37mr14392123a12.5.1728396732938; Tue, 08 Oct 2024 07:12:12 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c8e05eb7f0sm4359171a12.72.2024.10.08.07.12.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 07:12:11 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Tue, 08 Oct 2024 14:11:54 +0000 Subject: [PATCH 08/17] pack-objects: add --path-walk option Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: gitster@pobox.com, johannes.schindelin@gmx.de, peff@peff.net, ps@pks.im, me@ttaylorr.com, johncai86@gmail.com, newren@gmail.com, christian.couder@gmail.com, kristofferhaugsbakk@fastmail.com, Derrick Stolee , Derrick Stolee From: Derrick Stolee From: Derrick Stolee In order to more easily compute delta bases among objects that appear at the exact same path, add a --path-walk option to 'git pack-objects'. This option will use the path-walk API instead of the object walk given by the revision machinery. Since objects will be provided in batches representing a common path, those objects can be tested for delta bases immediately instead of waiting for a sort of the full object list by name-hash. This has multiple benefits, including avoiding collisions by name-hash. The objects marked as UNINTERESTING are included in these batches, so we are guaranteeing some locality to find good delta bases. After the individual passes are done on a per-path basis, the default name-hash is used to find other opportunistic delta bases that did not match exactly by the full path name. The current implementation performs delta calculations while walking objects, which is not ideal for a few reasons. First, this will cause the "Enumerating objects" phase to be much longer than usual. Second, it does not take advantage of threading during the path-scoped delta calculations. Even with this lack of threading, the path-walk option is sometimes faster than the usual approach. Future changes will refactor this code to allow for threading, but that complexity is deferred until later to keep this patch as simple as possible. This new walk is incompatible with some features and is ignored by others: * Object filters are not currently integrated with the path-walk API, such as sparse-checkout or tree depth. A blobless packfile could be integrated easily, but that is deferred for later. * Server-focused features such as delta islands, shallow packs, and using a bitmap index are incompatible with the path-walk API. * The path walk API is only compatible with the --revs option, not taking object lists or pack lists over stdin. These alternative ways to specify the objects currently ignores the --path-walk option without even a warning. Future changes will create performance tests that demonstrate the power of this approach. Signed-off-by: Derrick Stolee --- Documentation/git-pack-objects.txt | 13 +- Documentation/technical/api-path-walk.txt | 3 +- builtin/pack-objects.c | 147 ++++++++++++++++++++-- t/t5300-pack-object.sh | 17 +++ 4 files changed, 169 insertions(+), 11 deletions(-) diff --git a/Documentation/git-pack-objects.txt b/Documentation/git-pack-objects.txt index e32404c6aae..f2fda800a43 100644 --- a/Documentation/git-pack-objects.txt +++ b/Documentation/git-pack-objects.txt @@ -15,7 +15,8 @@ SYNOPSIS [--revs [--unpacked | --all]] [--keep-pack=] [--cruft] [--cruft-expiration=