You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Eric Rannaud (JIRA)" <ji...@apache.org> on 2011/06/22 21:05:47 UTC

[jira] [Updated] (THRIFT-1188) C++: Use bit fields for a more compact __isset struct

     [ https://issues.apache.org/jira/browse/THRIFT-1188?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Rannaud updated THRIFT-1188:
---------------------------------

      Priority: Major  (was: Minor)
    Issue Type: New Feature  (was: Improvement)

> 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: New Feature
>    Affects Versions: 0.6.1, 0.7
>            Reporter: Eric Rannaud
>         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