Re: [PATCH 2/5] odb/source-files: fix performance when streaming objects with alternates
- From
Justin Tobler <jltobler@gmail.com>
- Date
- Oct 13, 2026, 20:51 UTC
- Message-ID
- <as6Y9mSZ-oZL2gcE@denethor>
- In-Reply-To
- <20261013-pks-odb-files-alternates-cleanups-v1-2-b7030ff2b26f@pks.im>
On 26/10/13 09:36AM, Patrick Steinhardt wrote:
Show 11 quoted lines
> 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.
Show 19 quoted lines
> 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