[ 
https://issues.apache.org/jira/browse/THRIFT-110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12625738#action_12625738
 ] 

Johan Stuyts commented on THRIFT-110:
-------------------------------------

Why would a more compact protocol require changes to the IDL? Couldn't the 
protocol itself decide if a more suitable representation can be written? Here 
is an example for writing integer fields:
{code}
if (0 <= v and v < {limit that requires at least four bytes})
{
  // Put code for vint on the stream
  // Put vint-encoded value on the stream
}
else if ({some negative number} <= v && v <= {some positive number})
{
  // Put code for zig-zag on the stream
  // Put zig-zag-encoded value on the stream
}
else
{
  // Put code for int on the stream
  // Put value on the stream
}
{code}

The values defined in {{TType.java}} are the ones structures must use to 
communicate with protocols, but there is no requirement for protocols to use 
them internally.

> A more compact format 
> ----------------------
>
>                 Key: THRIFT-110
>                 URL: https://issues.apache.org/jira/browse/THRIFT-110
>             Project: Thrift
>          Issue Type: Improvement
>            Reporter: Noble Paul
>
> 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.

Reply via email to