[
https://issues.apache.org/jira/browse/THRIFT-115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12737672#action_12737672
]
David Reiss commented on THRIFT-115:
------------------------------------
<dreiss> bryanduxbury: why does it start numbering from 1?
<bryanduxbury> dreiss: good question. i'll shift it to 0
<dreiss> put at least one underscore on the front of isset_bit_vector
<dreiss> This should be outside of the loop:
<dreiss> - indent(out) << "__isset." << field_name << " = other.__isset."
<< field_name << ";" << endl;
<dreiss> + indent(out) << "isset_bit_vector.clear();" << endl;
<dreiss> + indent(out) << "isset_bit_vector.or(other.isset_bit_vector);"
<< endl;
<bryanduxbury> none of the other instance variables are prefixed with _ in this
generator, i think
<dreiss> - indent(out) << "this.__isset." << field_name << " = value;"
<< endl;
<dreiss> the old version uses __isset
<dreiss> we should use leading underscores to avoid colliding with user-defined
names.
<dreiss> Actually, we should eventually just change the lexer to reject any
identifier that starts with an underscore
If the "clear/set" issue that I pointed out is indeed a bug, then I assume the
tests fail with the current patch. If they don't, we should improve the tests.
> Isset structure has a large memory footprint
> --------------------------------------------
>
> Key: THRIFT-115
> URL: https://issues.apache.org/jira/browse/THRIFT-115
> Project: Thrift
> Issue Type: Improvement
> Components: Library (Java)
> Reporter: Bryan Duxbury
> Assignee: Bryan Duxbury
> Priority: Minor
> Fix For: 0.2
>
> Attachments: thrift-115-v2.patch, thrift-115-v3.patch,
> thrift-115-v4.patch, thrift-115.patch
>
>
> My understanding is that in Java, booleans stored individually (that is,
> outside an array) take up the same space as an int in the host JVM. This
> means that they might take up to 4 bytes each! As a result, the Isset classes
> internal to generated structs consume a considerable quantity of memory.
> Boolean arrays in Java shrink each element to a byte, which would be an
> improvement. We could go even further and use a bit field and pack all the
> isset values into a few bytes. This could shave a considerable bit of the
> memory footprint.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.