Skip to content

Thread-local Stack Allocator for Routing Algorithms #4213

@daniel-j-h

Description

@daniel-j-h

Implementing alternatives on mld (#3905, #4047) I used a couple of local stdlib containers which all use the global allocator to grow their internal capacity. Other routing algorithms do the same: for example the ch alternatives algorithm uses stdlib vectors, sets, etc.

Most of the time these stdlib containers are small - for example to store a couple thousands boundary nodes - and are temporary in nature getting created and destroyed over and over again.

We should hook in a thread-local stack allocator (similar to how we use thread-local heaps in the SearchEngineData) to handle small and repeated requests fast(er) and automatically grows.

Here's Hinnant's stack alloc we could use for this: http://howardhinnant.github.io/stack_alloc.html

Note: especially in the context of alternatives we should give the unpacking cache a try, too: #3835

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions