Dear Wiki user, You have subscribed to a wiki page or wiki category on "Thrift Wiki" for change notification.
The following page has been changed by NoblePaul: http://wiki.apache.org/thrift/New_compact_binary_protocol ------------------------------------------------------------------------------ There's been numerous discussion on how to implement a new more compact binary protocol. The discussions become hard to follow after a while so this page is intended to be used as an easy to use summary that can later be formalized into different options and finally become a specification. Help needed to fill this page with further details, suggestions and pros/cons for each suggestion. == Implementation suggestions == - === Encode i16, i32 and i64 types saved as variable size integers === + === Encode i32 and i64 types saved as variable size integers === ||'''Suggestion''' || '''Pros''' || '''Cons'''|| ||ZIP encoding (variable length encoding) for only positive values|| save a max of 3 bytes for small ints ||user has to specify the new type|| ||Base 128 + zigzag, borrow from protocol buffers?|| ||user has to specify whether zigzag needs to be used for efficiency|| @@ -13, +13 @@ === Remove / reduce the size of field prefix tags === - ||Suggestion||Pros||Cons|| + || '''Suggestion''' || '''Pros''' || '''Cons''' || - ||Reduce from 3 bytes per field to 1 byte, see [http://publists.facebook.com/pipermail/thrift/2008-January/000275.html mail]||Retains versioning support||Only good for dense structs[[BR]]Breaks down if type modifiers/hints need to go into type field|| + ||Reduce from 3 bytes per field to 1 byte, see [http://publists.facebook.com/pipermail/thrift/2008-January/000275.html mail] || Retains versioning support || Only good for dense structs[[BR]]Breaks down if type modifiers/hints need to go into type field || ||1-byte type-and-modifier, variable length int for field id|| || || - ||Drop field prefix altogether||saves tons of space|||| + ||Drop field prefix altogether||saves tons of space|| no versioning is possible|| + ||Use a per-struct variable length bitset to specify which all fields present . Preserve type info||Saves 1 bit/field and adds 1 byte/ 7 fields || || === Type changes === - ||Suggestion||Pros||Cons|| + ||'''Suggestion''' || '''Pros''' || '''Cons'''|| + ||ZIP encoding (variable length encoding) for only positive values|| save a max of 3 bytes for small ints ||user has to specify the new type|| ||Unsigned integers||Would alleviate need for separate zigzag type||Unsigned ints don't exist in all languages|| ||Type annotations||Allows us to specify encoding details about the fields/types that the protocols may or may not use|||| ||Variable ints for string, binary, and collection sizes||Will often shrink to one or two bytes|| ||
