You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Bryan Duxbury (JIRA)" <ji...@apache.org> on 2008/08/20 23:52:44 UTC

[jira] Assigned: (THRIFT-112) Initialize method is unnecessarily slow for structs with many optional fields

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

Bryan Duxbury reassigned THRIFT-112:
------------------------------------

    Assignee: Bryan Duxbury

> Initialize method is unnecessarily slow for structs with many optional fields
> -----------------------------------------------------------------------------
>
>                 Key: THRIFT-112
>                 URL: https://issues.apache.org/jira/browse/THRIFT-112
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Library (Ruby)
>            Reporter: Bryan Duxbury
>            Assignee: Bryan Duxbury
>            Priority: Minor
>         Attachments: thrift-112.patch
>
>
> We have Thrift structs that are composed of mostly optional fields, and only one is occupied. (The struct is used like a C union.) In Ruby, this leads to an inordinate amount of time being spent creating instances. We've tracked this down to the initialize method, which iterates over all fields, setting defaults or taking constructor args as needed. A fairly effective fix for us was to only iterate the union of fields that have default values or are being set via the constructor. In the worst case, either when all fields have default values or when the user is setting all fields' values via the constructor, it is no more costly than the existing implementation.

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