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

Bryan Duxbury updated THRIFT-10:
--------------------------------

    Attachment: thrift-10-v2.patch

Here's an updated version of this patch. I made a few changes:
 * Used final members instead of accessors in descriptor classes
 * Made the accesor classes final
 * Instead of MYSTRUCT_STRUCT, I just named the static struct descriptor 
STRUCT_DESC
 * Instead of MY_FIELD, I named the field descriptors MY_FIELD_DESC
 * I had to update if/reflection_limited.thrift to have the correct apache 
namespace, and regenerated the reflection.limited code
 * I found a duplicate FieldMetaData.java that should have been deleted but was 
not, so I whacked that

In a previous tiny commit, I added SerializationBenchmark.java, which is geared 
up to test this change. In trunk, writing 10M OneOfEachs without any real io 
takes 17879, while with this patch it takes 17022, which is about 4.8% speedup. 
The deserialization test also shows a measurable improvement, but because io 
has to be included in that test, it's not as big of a percent speedup (about 
2%). (I could probably amend that test to not count some of the 
non-serialization time, but I'm being lazy.) So, it seems like this patch 
should be a modest performance gain and a simplification to the generated code 
and protocols. 

> 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
>            Priority: Minor
>             Fix For: 0.1
>
>         Attachments: ImmutableProtocolComponentDescriptors2.patch, 
> SerializationBenchmarkMain.java, thrift-10-v2.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