C++: Use bit fields for a more compact __isset struct
-----------------------------------------------------
Key: THRIFT-1188
URL: https://issues.apache.org/jira/browse/THRIFT-1188
Project: Thrift
Issue Type: Improvement
Affects Versions: 0.6.1, 0.7
Reporter: Eric Rannaud
Priority: Minor
Attachments: thrift-cpp-isset-bitfield.patch
With the C++ generator, the __isset structure is made of bool fields.
For Thrift objects with many optional fields, the memory impact of the __isset
structure with respect to the actual data payload can be significant.
This patch simply turns each member of __isset into a 1-bit field.
This patch does not pack the structure as I'm not sure how this should be
handled in general. As is, it will depend on the compiler whether there is a
real size gain (with GCC 4.5 the struct is packed at all optimization levels).
To enforce packing in all cases, should I define a T_ATTRIBUTE_PACKED macro in
Thrift.h? That wouldn't work for compilers that use #pragma, however.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira