From ddfac32b85794d1abe7e488290f8df7c26f0f5d4 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 11 Dec 2020 15:25:08 -0800 Subject: [PATCH] ircd::ios: Elide std::function for hot descriptor calls. --- include/ircd/ios.h | 4 ++-- ircd/fs_aio.cc | 4 ++-- ircd/fs_iou.cc | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/ircd/ios.h b/include/ircd/ios.h index cfed73d5f..8a9877b50 100644 --- a/include/ircd/ios.h +++ b/include/ircd/ios.h @@ -110,8 +110,8 @@ struct ircd::ios::descriptor string_view name; uint64_t id {++ids}; std::unique_ptr stats; - std::function allocator; - std::function deallocator; + void *(*allocator)(handler &, const size_t &); + void (*deallocator)(handler &, void *const &, const size_t &); std::vector> history; // epoch, cycles uint8_t history_pos {0}; bool continuation {false}; diff --git a/ircd/fs_aio.cc b/ircd/fs_aio.cc index b464f4272..8bc16a812 100644 --- a/ircd/fs_aio.cc +++ b/ircd/fs_aio.cc @@ -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, diff --git a/ircd/fs_iou.cc b/ircd/fs_iou.cc index 003a6c071..49b3b9496 100644 --- a/ircd/fs_iou.cc +++ b/ircd/fs_iou.cc @@ -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.