0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-15 14:31:11 +01:00

ircd::ios: Elide std::function for hot descriptor calls.

This commit is contained in:
Jason Volk 2020-12-11 15:25:08 -08:00
parent 5151a3b934
commit ddfac32b85
3 changed files with 6 additions and 6 deletions

View file

@ -110,8 +110,8 @@ struct ircd::ios::descriptor
string_view name;
uint64_t id {++ids};
std::unique_ptr<struct stats> stats;
std::function<void *(handler &, const size_t &)> allocator;
std::function<void (handler &, void *const &, const size_t &)> deallocator;
void *(*allocator)(handler &, const size_t &);
void (*deallocator)(handler &, void *const &, const size_t &);
std::vector<std::array<uint64_t, 2>> history; // epoch, cycles
uint8_t history_pos {0};
bool continuation {false};

View file

@ -1120,7 +1120,7 @@ ircd::fs::aio::system::handle_descriptor
// appears to excessively allocate and deallocate 120 bytes; this
// is a simple asynchronous operation, we can do better (and perhaps
// even better than this below).
[](auto &handler, const size_t &size)
[](ios::handler &handler, const size_t &size) -> void *
{
assert(ircd::fs::aio::system);
auto &system(*ircd::fs::aio::system);
@ -1136,7 +1136,7 @@ ircd::fs::aio::system::handle_descriptor
},
// no deallocation; satisfied by class member unique_ptr
[](auto &handler, void *const &ptr, const auto &size) {},
[](ios::handler &handler, void *const &ptr, const size_t &size) {},
// continuation
true,

View file

@ -520,7 +520,7 @@ ircd::fs::iou::system::handle_descriptor
// appears to excessively allocate and deallocate 120 bytes; this
// is a simple asynchronous operation, we can do better (and perhaps
// even better than this below).
[](auto &handler, const size_t &size)
[](ios::handler &handler, const size_t &size) -> void *
{
assert(ircd::fs::iou::system);
auto &system(*ircd::fs::iou::system);
@ -536,7 +536,7 @@ ircd::fs::iou::system::handle_descriptor
},
// no deallocation; satisfied by class member unique_ptr
[](auto &handler, void *const &ptr, const auto &size) {}
[](ios::handler &handler, void *const &ptr, const size_t &size) -> void {}
};
/// Handle notifications that requests are complete.