boostorg / boostorg/redis

Allocate only once for the request notifier and multiplexer::elem

Open
#350 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
282
Forks
49
PR merge metrics
No merged PRs in 30d

Description

We currently perform one dynamic allocation for the `notifier` and one for the `multiplexer::elem` https://github.com/boostorg/redis/blob/00f3ec9b78454211c7b8d461b11411c8b1ef1ad3/include/boost/redis/connection.hpp#L193-L194

It looks like it is possible to put these two data structures into a single `struct` and allocate only once. As part of the ticket we should also cache these structs to achieve asymptotically zero allocations.

PS1: Do we need to allocate `multiplexer::elem` dynamically at all? These structs are not that big and it looks like they can be also copied. Btw, are there any lower overhead alternatives to `shared_ptr` for single-threaded use?

PS2: Is there any alternative to `std::function` with better small buffer optimization? Most adapters are pretty small data structures.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.