Re: [PATCH 02/13] refs: introduce `.ref` field for the base iterator
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Oct 8, 2025, 13:44 UTC
- Message-ID
- <aOZqsM2TKv3g8lJ3@pks.im>
- In-Reply-To
- <CAOLa=ZR0KWkpB4kjFm2g8F-PK_LWpE20P21rmJGOLONCkfN7yA@mail.gmail.com>
On Tue, Oct 07, 2025 at 07:24:01AM -0700, Karthik Nayak wrote:
Show 20 quoted lines
> Patrick Steinhardt <ps@pks.im> 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