-
Notifications
You must be signed in to change notification settings - Fork 45
Description
We currently perform one dynamic allocation for the notifier and one for the multiplexer::elem
redis/include/boost/redis/connection.hpp
Lines 193 to 194 in 00f3ec9
| auto notifier = std::make_shared<exec_notifier_type>(get_executor(), 1); | |
| auto info = make_elem(req, std::move(adapter)); |
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.