thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jens Geyer" <>
Subject Re: updating to longer ints
Date Fri, 15 Mar 2013 18:57:07 GMT
> I think TCompactProtocol uses var length ints, achieving
> something similar to what you mentioned.

Yep, but good point anyway.

> Not that this would help w/ the original issue.

Of course, because it is only "something similar" and suffers from the same 
limitations. What the OP suggests and/or what I was thinking of is something 
like this (this would be generated C++ code for one field) :

      case 1:
        switch( ftype) {
        case ::apache::thrift::protocol::T_BYTE:
            int8_t   tmp4710;
            xfer += iprot->readByte(tmp4710);
            this->thing = tmp4710;
            this->__isset.thing = true;
        case ::apache::thrift::protocol::T_I16:
            int16_t  tmp4711;
            xfer += iprot->readI16(tmp4711);
            this->thing = tmp4711;
            this->__isset.thing = true;

        case ::apache::thrift::protocol::T_I32:
            xfer += iprot->readI32(this->thing);
            this->__isset.thing = true;
        case ::apache::thrift::protocol::T_I64:
            throw TProtocolException(TProtocolException::SIZE_LIMIT);
          xfer += iprot->skip(ftype);

and similarly with the generated write() code. This way all protocols would 
profit form it (except for those where it makes no difference with regard to 
serialized data, such as JSON).

The two biggest problem that I see are a) it breaks compatibility, so we 
have to increase the VERSION number, and b) it might affect overall 
serialization/deserialization performance.


View raw message