-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Thread-local Stack Allocator for Routing Algorithms #4213
Description
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