Skip to content

Many index-based walking of linked lists #37

@BrianSipos

Description

@BrianSipos

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));
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions