Subject: Re: [PATCH 02/13] refs: introduce `.ref` field for the base iterator

From: Patrick Steinhardt <[email-masked]>
Date: Wed, 8 Oct 2025 15:44:16 +0200

On Tue, Oct 07, 2025 at 07:24:01AM -0700, Karthik Nayak wrote:
> Patrick Steinhardt <[email-masked]> writes:
> 
> > The base iterator has a couple of fields that tracks the name, target,
> > object ID and flags for the current reference. Due do this design we
> > have to create a new `struct reference` whenever we want to hand over
> > that reference to the callback function, which is tedious and not very
> > efficient.
> >
> > Convert the structure to instead contain a `stuct reference` as member.
> 
> s/stuct/struct
> 
> > This member is expected to be populated by the implementations of the
> > iterator and is handed over to the callback directly.
> >
> 
> Wouldn't this also add the burden on each backend to ensure we don't
> serve stale data for each '_advance()' call?
> 
> Would it make sense to reset this data in `ref_iterator_advance()`?

Yeah, that's true indeed. I was a bit hesitant to do such a change
though because the ref iterator is part of a bunch of hot loops. I'll do
some benchmarking here to figure out whether a memset(3p) would have a
negative impact on performance.

Patrick