Git development
 help / color / mirror / Atom feed
From: Justin Tobler <jltobler@gmail.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	 Wolfgang Kritzinger <wkritzinger@atlassian.com>
Subject: Re: [PATCH 2/5] odb/source-files: fix performance when streaming objects with alternates
Date: Tue, 13 Oct 2026 15:51:40 -0500	[thread overview]
Message-ID: <as6Y9mSZ-oZL2gcE@denethor> (raw)
In-Reply-To: <20261013-pks-odb-files-alternates-cleanups-v1-2-b7030ff2b26f@pks.im>

On 26/10/13 09:36AM, Patrick Steinhardt wrote:
> This patch is essentially the equivalent to the preceding patch, but for
> streaming objects instead of just reading them directly.
> 
> Exercising performance is a bit more complicated here as streaming only
> really kicks in for large objects. Furthermore, I expect that the impact
> is not as big as with the last commit, either, because for large objects
> the time to stat the file will probably be dwarfed by the time it takes
> to read the object itself.
> 
> But even though this is probably not as impactful, it makes sense anyway
> to do this change to align behaviour across both of these functions.

I agree that this change is probably not as impactful, but unifying the
behavior makes sense to me and doesn't really have any draw backs. I
think this is a good change.

> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
>  odb/source-files.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/odb/source-files.c b/odb/source-files.c
> index 9268f5aa9a..54235821d5 100644
> --- a/odb/source-files.c
> +++ b/odb/source-files.c
> @@ -462,8 +462,10 @@ static int odb_source_files_read_object_stream(struct odb_stream **out,
>  	struct odb_source_files *files = odb_source_files_downcast(source);
>  
>  	for (struct odb_files_dir *dir = files->dirs; dir; dir = dir->next)
> -		if (!odb_source_read_object_stream(out, &dir->packed->base, oid) ||
> -		    !odb_source_read_object_stream(out, &dir->loose->base, oid))
> +		if (!odb_source_read_object_stream(out, &dir->packed->base, oid))
> +			return 0;
> +	for (struct odb_files_dir *dir = files->dirs; dir; dir = dir->next)
> +		if (!odb_source_read_object_stream(out, &dir->loose->base, oid))

Just like the last patch, each source looks through its packfiles first
before looking at loose objects. Looks good.

-Justin

  reply	other threads:[~2026-10-13 20:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13  7:36 [PATCH 0/5] odb/files: cleanups and improvements for alternates Patrick Steinhardt
2026-10-13  7:36 ` [PATCH 1/5] odb/source-files: fix performance when reading objects with alternates Patrick Steinhardt
2026-10-13 20:46   ` Justin Tobler
2026-10-13  7:36 ` [PATCH 2/5] odb/source-files: fix performance when streaming " Patrick Steinhardt
2026-10-13 20:51   ` Justin Tobler [this message]
2026-10-13  7:36 ` [PATCH 3/5] odb/source-files: make the second read an implementation detail Patrick Steinhardt
2026-10-13 21:28   ` Justin Tobler
2026-10-13  7:36 ` [PATCH 4/5] odb: remove read loop for found objects Patrick Steinhardt
2026-10-13 21:48   ` Justin Tobler
2026-10-13  7:36 ` [PATCH 5/5] odb/source: drop `local` flag Patrick Steinhardt
2026-10-13 22:44   ` Justin Tobler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=as6Y9mSZ-oZL2gcE@denethor \
    --to=jltobler@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=ps@pks.im \
    --cc=wkritzinger@atlassian.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox