From 4aa901d0f9198b17c23adce704d18d767c033533 Mon Sep 17 00:00:00 2001 From: Jon Maltiel Swenson Date: Tue, 26 Apr 2016 18:12:20 -0700 Subject: [PATCH] Optimize away IOBuf clones on hot path Summary: 'get' is the most frequent memcached operation. On a get reply, we should go to heap as little as possible. This diff optimizes for this scenario, where replies have only one IOBuf field. Reviewed By: pavlo-fb Differential Revision: D3226592 fb-gh-sync-id: 92e1a1fac5735bd268691cf11990a96ae6fa8309 fbshipit-source-id: 92e1a1fac5735bd268691cf11990a96ae6fa8309 --- folly/io/Cursor.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/folly/io/Cursor.h b/folly/io/Cursor.h index 3cf369e9..a1309239 100644 --- a/folly/io/Cursor.h +++ b/folly/io/Cursor.h @@ -913,6 +913,10 @@ class QueueAppender : public detail::Writable { } } + void insert(const folly::IOBuf& buf) { + insert(buf.clone()); + } + private: folly::IOBufQueue* queue_; size_t growth_; -- 2.34.1