Many index-based walking of linked lists
Open
Nobody has claimed this yet.
enhancement
good first issue
- Dominant language
- C
- Stars
- 14
- Forks
- 9
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 33
Description
There are many cases of walking linked lists using index iteration, which will be exponentially slower than using list iterators.
Replacing these is simple, such as replacing the slow strategy
for (size_t target_index = 0; target_index < uint64_list_size(self->targets); target_index++)
{
QCBOREncode_AddUInt64(&encoder, *uint64_list_get(self->targets, target_index));
}
with the iterator strategy
uint64_list_it_t it;
for (uint64_list_it(it, self->targets); !uint64_list_end_p(it); uint64_list_next(it))
{
QCBOREncode_AddUInt64(&encoder, *uint64_list_cref(it));
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Search the repository for linked-list loops using size and index-based access, then compare each case with the uint64_list iterator example in the issue. Replace the applicable walking patterns and verify that all relevant cases use iterators without breaking the project’s existing checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- performance
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100