From patchwork Sun Oct 20 13:43:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee X-Patchwork-Id: 13843086 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (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 53516192B62 for ; Sun, 20 Oct 2024 13:43:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729431828; cv=none; b=cve0YrsAG9G5CnfJagpCxifmHabM1c36ezPTdnju6lwlwspJB3fBNHFpBjWPyr4ArAZIOKLkuoc58BGSclrnH5zFLxjoeTYChaX7/btzZOOhQ0KNokyAe/B9yOLIQPVYLV6gmlAiu3LBlW/vdvISnbCRAkJoMKihtK2TRSuCfVk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729431828; 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=KiQXkC2RU38q/ODJTBqmzbRyOAKbeJG1UoUP/AHz08KtkIobw4Gbvd5XGDO7WLUu5TVMB4ymWJCcBYOu2gsEGUGWkJVSt/bdTwpwV0IwpgEW7O211KOn3Q2K+EjLklel1UFLeYHQ/cBj6fZHicSqkqEL/YKVDXwD2XbUPAknep0= 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=eG1ksoeA; arc=none smtp.client-ip=209.85.218.46 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="eG1ksoeA" Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a9a0472306cso475545766b.3 for ; Sun, 20 Oct 2024 06:43:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729431823; x=1730036623; 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=eG1ksoeAj/PQIGZUrg8v6bTzad4+rVia2teOZlw54XUn2FnpvkEoMfopIMSmQGaFgD HAvyDOehxzVWJOy89G/EIt3wbn7QK9wHJudKLT0OFhCzSGQt66MNvy7qtYAL4fefjjzj iFLR0tNJ6IRtFKYLDtN7cam+rrZfiaoGbU063C4v/20qCQSEz16LNGGiuGP4tpOcdqnQ GFjMg/9S2GcuU/OnXNKPOP+w8DkX+jfg7Rp572QHG5anS2xM/kFOKVkfopaxphpMSQO4 JpS0R7bTNQwBVvYkYv8cdiD25cZ00OyBNOuNA4MqiZFwL17VlDvpSVV88uWJR13iaGrq st1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729431823; x=1730036623; 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=DJ0e6+zji5Kse4uM2ElNSPXx1G4pZORHIw0dbiXMBK5OTnRbsa7qnvb0jScmye9mRk sVrr0KNRKt2SmqKOHXoK/P4iS3EmoSRVcjHDMNQeoR5fGWZkpzMs8FQOT14dYHir0/gt L75e10uhDK16IKHzxVgdsjqz8tMlS2grTmo4BxfUYnwG4HxuJYnRMdZCe/GgeGOBRPhf HLMArN5uti70PgsQ4I/FKhulF6BrTNtimWNQzIoIwxWox4SknSzO2XFCPh3nXHOeqjpU WIdfSSZDAGGDIwg7nFSve3kELdUhSCmofRSN8DGlzi5ZT0RUbLolCHHyz3Dxd3dJc+12 ap7w== X-Gm-Message-State: AOJu0YyZwy3Gj4sh/2ZGD12AKEynuxEHNxgt92Auwd9q+AH5URj+P/D8 jmN8/vztkOdooVhfL/VnzCQP9TEIymMuje35BcEnyMv0tGiRYo1A3AycEA== X-Google-Smtp-Source: AGHT+IHXBtv6c6mWbDOB8pFwBWrhVAQbSjg2jl0pgyMSi+3Cmtb5WODn0TVUiVT2vyf5l9YpWkx2Sg== X-Received: by 2002:a17:907:7f23:b0:a9a:eeb:b263 with SMTP id a640c23a62f3a-a9a69cd38cemr783569566b.58.1729431822603; Sun, 20 Oct 2024 06:43:42 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a9157366fsm91803866b.181.2024.10.20.06.43.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Oct 2024 06:43:42 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sun, 20 Oct 2024 13:43:21 +0000 Subject: [PATCH v2 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=