Skip to content

Preallocate lists and vectors with the right size to prevent reallocation during iterations #335

Description

@cregouby

Current Situation

A lot of lists are allocated empty before an iteration loop :

report of undefined size list() usage

same for vectors

report of undefined size c() usage

this force list / vector re-allocation at each iteration which is a time costly operation leading to sub-optimal performance.

Expected

list shall be preallocated to their target size when possible.
vector shall be allocated with the right type and size when possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GSoCIntended to be covered by the GSoC teamenhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions