Track absolute position of the cursor
authorStepan Palamarchuk <stepan@fb.com>
Tue, 16 Jan 2018 00:36:45 +0000 (16:36 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 16 Jan 2018 00:54:23 +0000 (16:54 -0800)
commitafde52ff7655ba79759eafdbee14b3fe47428fce
tree885edc03b33f670b92670550273ad9a1a6801555
parent2c730d6fe79b5642133c55545c4ed7570ce2abb9
Track absolute position of the cursor

Summary:
Start tracking the position of the cursor from the head of IOBuf chain. This comes at almost no cost (one arithmetic operation on IOBuf advance).

The main use case for this cursor is Thrift deserialization code. It allows us to stop accumulating `xfer` on every single byte/field/element write and instead get it from Cursor in the end (when we're exiting Thrift code).
This allows achieving ~10% better performance of deserialization.

Reviewed By: yfeldblum

Differential Revision: D6646813

fbshipit-source-id: 8f796854a24a411698e96afe037695e816813022
folly/io/Cursor.h
folly/io/test/IOBufCursorTest.cpp