Skip to content

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

@mzimbres

Description

@mzimbres

We currently perform one dynamic allocation for the notifier and one for the multiplexer::elem

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions