[
https://issues.apache.org/jira/browse/THRIFT-110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12638058#action_12638058
]
Bryan Duxbury commented on THRIFT-110:
--------------------------------------
You're right, they're not part of the IDL, since that would actually be less
compact in some circumstances.
When you read a field, the first thing you do is read the field id, which is a
varint. Then, you read the 1-byte type identifier. Mask off the 4 LSB, and
there you have your base type. Depending on the type, the 4 MSB might have more
information for you. Take the string case. Mask off the 4 MSB, shift it down 4
positions, and then check the value. If it's 0-14, it means what follows is a
0-14 byte string. If it's 15, it means that what follows is a varint-encoded
size. You read the size as a varint, then read the appropriate number of string
bytes.
Does that example make sense?
> A more compact format
> ----------------------
>
> Key: THRIFT-110
> URL: https://issues.apache.org/jira/browse/THRIFT-110
> Project: Thrift
> Issue Type: Improvement
> Reporter: Noble Paul
> Attachments: compact_proto_spec.txt, compact_proto_spec.txt
>
>
> Thrift is not very compact in writing out data as (say protobuf) . It does
> not have the concept of variable length integers and various other
> optimizations possible . In Solr we use a lot of such optimizations to make a
> very compact payload. Thrift has a lot common with that format.
> It is all done in a single class
> http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/common/util/NamedListCodec.java?revision=685640&view=markup
> The other optimizations include writing type/value in same byte, very fast
> writes of Strings, externalizable strings etc
> We could use a thrift format for non-java clients and I would like to see it
> as compact as the current java version
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.