folly::io::QueueAppender speedup
authorTudor Bosman <tudorb@fb.com>
Wed, 28 Aug 2013 01:31:27 +0000 (18:31 -0700)
committerSara Golemon <sgolemon@fb.com>
Thu, 29 Aug 2013 16:54:26 +0000 (09:54 -0700)
commitbae9c76c2a7f76355d2d31d8fb98718314bb6a82
tree2881fbcd06b0f07f1822bf789c59178406857eb7
parent3086657e5ffbf5c6a775c3343f847403bf3ff13a
folly::io::QueueAppender speedup

Summary:
Make QueueAppender (as used in the thrift2 protocol writer) much faster.
Benchmarks in a separate diff (for thrift2).

A few things:
- remove IOBuf range checks in optimized mode
- simplify QueueAppender: maxGrowth wasn't used, removed it
- simplify QueueAppender: don't duplicate the work in IOBufQueue, let
IOBufQueue keep track of memory
- speed up IOBuf::isSharedOne(): fast-path case where the buffer was never
shared (so don't read the reference count in that case)
- fast-path in QueueAppender if size is known at compile time

@override-unit-failures
compilation errors outside of folly fixed in subsequent diff

Test Plan: folly/io/test, both dbg and opt

Reviewed By: davejwatson@fb.com

FB internal diff: D946907
folly/io/Cursor.h
folly/io/IOBuf.cpp
folly/io/IOBuf.h
folly/io/IOBufQueue.cpp
folly/io/IOBufQueue.h
folly/io/test/IOBufCursorTest.cpp