From: Jon Maltiel Swenson Date: Wed, 27 Apr 2016 01:12:20 +0000 (-0700) Subject: Optimize away IOBuf clones on hot path X-Git-Tag: 2016.07.26~319 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=4aa901d0f9198b17c23adce704d18d767c033533;p=folly.git 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 --- 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_;