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

Noble Paul commented on THRIFT-110:
-----------------------------------

David - Your are right . 
The type information is important. Because if it is not there we do not know 
how many bytes to skip. But writing down the id in the field is more 
inefficient than using a variable length bitset. typically , structures have 3 
or more fields index starting from 1. 


In the current system if I add a new struct field to an existing object , it 
fails because it does not write down which struct it is. So it does not know 
how many bytes to skip.

I recommend writing down the name of the struct as in IDL (as an extern string. 
so it is written only once)  for all struct objects so that if the deserializer 
already is aware of the struct it knows how many bytes to skip or if it does 
not know about it it can throw an error saying "unknown struct".

This approach can be useful for writing down heterogeneous collections

bq.If you only have one field set but that field happens to be number 600.
If you have only one field and the id is 600 the system does not break. but why 
would a user do it?

> 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