Re: [PATCH 02/13] refs: introduce `.ref` field for the base iterator
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Oct 8, 2025, 15:03 UTC
- Message-ID
- <aOZ9Lhjo1n3B70kF@pks.im>
- In-Reply-To
- <aOZqsM2TKv3g8lJ3@pks.im>
On Wed, Oct 08, 2025 at 03:44:16PM +0200, Patrick Steinhardt wrote:
Show 26 quoted lines
> On Tue, Oct 07, 2025 at 07:24:01AM -0700, Karthik Nayak wrote: > > 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.
Okay, I've measured this and it doesn't make any difference. I'll add another patch to do this.
Patrick