[ 
https://issues.apache.org/jira/browse/THRIFT-10?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12671537#action_12671537
 ] 

David Reiss commented on THRIFT-10:
-----------------------------------

{code}
+    bool is_upper = isupper(character) && character != '_' && (character < '0' 
|| '9' < character);
{code}
should just be
{code}
+    bool is_upper = isupper(character);
{code}

I didn't actually use git to find the trailing whitespace this time, just grep 
for "^+.* $" (add a \ before the + if you are using extended regexps).  There 
are still two more:

{code}
-  public TField() {}
-
+  public TField() {
+    this("", TType.STOP, (short)0);
+  }
+  
{code}

{code}
-    out <<
-      indent() << "field.name = \"" << (*f_iter)->get_name() << "\";" << endl 
<<
-      indent() << "field.type = " << type_to_enum((*f_iter)->get_type()) << 
";" << endl <<
-      indent() << "field.id = " << upcase_string((*f_iter)->get_name()) << ";" 
<< endl <<
-      indent() << "oprot.writeFieldBegin(field);" << endl;
-
+    indent(out) << "oprot.writeFieldBegin(" << 
constant_name((*f_iter)->get_name()) << "_FIELD_DESC);" << endl;
+    
{code}


> Descriptors used during serialization should be immutable objects
> -----------------------------------------------------------------
>
>                 Key: THRIFT-10
>                 URL: https://issues.apache.org/jira/browse/THRIFT-10
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Library (Java)
>            Reporter: Johan Stuyts
>            Assignee: Bryan Duxbury
>            Priority: Minor
>             Fix For: 0.1
>
>         Attachments: ImmutableProtocolComponentDescriptors2.patch, 
> SerializationBenchmarkMain.java, thrift-10-v2.patch, thrift-10-v3.patch
>
>
> The descriptors for structures, messages, types, etc. in package 
> {{com.facebook.thrift.protocol}} which are used during (de-)serialization 
> have mutable attributes. This forces the creation of these descriptors for 
> each use even if the data is constant in many cases.
> By changing the descriptors to be immutable, structures and protocols can use 
> singleton, constant instances during (de-)serialization. This will improve 
> performance a bit by preventing the creation of hundreds (thousands?) of 
> short-lived objects per second during heavy use of Thrift.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to