From 3a1edf0c32e119504094c273a9ca48d523dd1c30 Mon Sep 17 00:00:00 2001 From: Or Ozeri Date: Sun, 6 Jun 2021 16:55:15 +0300 Subject: [PATCH] msg/async/ProtocolV2: optimize append_frame The commonly used append_frame function currently copies frame data, incurring expensive heap allocation and data copying. Instead, switch to claiming the frame data, re-using it without copying. Signed-off-by: Or Ozeri --- src/msg/async/ProtocolV2.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/msg/async/ProtocolV2.cc b/src/msg/async/ProtocolV2.cc index 0f40b32ac46b1..0e4afd2255f78 100644 --- a/src/msg/async/ProtocolV2.cc +++ b/src/msg/async/ProtocolV2.cc @@ -585,7 +585,7 @@ bool ProtocolV2::append_frame(F& frame) { ldout(cct, 25) << __func__ << " assembled frame " << bl.length() << " bytes " << tx_frame_asm << dendl; - connection->outgoing_bl.append(bl); + connection->outgoing_bl.claim_append(bl); return true; } -- 2.39.5