Re: [PATCH 3/6] connected: refactor iterator to return next object ID directly
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Aug 20, 2021, 14:32 UTC
- Message-ID
- <ffb5da19-937e-fba6-10f8-3993ca5ff0ef@gmail.com>
- In-Reply-To
- <3bdad7bc8b0debd44138a4d3df5744d5a245475d.1629452412.git.ps@pks.im>
On 8/20/2021 6:08 AM, Patrick Steinhardt wrote:
Show 12 quoted lines
> The object ID iterator used by the connectivity checks returns the next > object ID via an out-parameter and then uses a return code to indicate > whether an item was found. This is a bit roundabout: instead of a > separate error code, we can just retrun the next object ID directly and > use `NULL` pointers as indicator that the iterator got no items left. > Furthermore, this avoids a copy of the object ID. > > Refactor the iterator and all its implementations to return object IDs > directly. While I was honestly hoping for a small speedup given that we > can now avoid a copy, both versions perform the same. Still, the end > result is easier to understand and thus it makes sense to keep this > refactoring regardless.
It's too bad about the lack of measurable performance gains, but the new code _is_ doing less, it's just not enough.
I agree that the new code organization is better.
Thanks, -Stolee