You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jake Farrell (JIRA)" <ji...@apache.org> on 2013/08/21 16:23:53 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 ]

Jake Farrell updated THRIFT-1188:
---------------------------------

    Component/s: C++ - Compiler
    
> 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
>          Components: C++ - Compiler
>    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.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira