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 2010/04/03 17:45:27 UTC

[jira] Created: (THRIFT-753) Don't look up TFieldIdEnum values with a map

Don't look up TFieldIdEnum values with a map
--------------------------------------------

                 Key: THRIFT-753
                 URL: https://issues.apache.org/jira/browse/THRIFT-753
             Project: Thrift
          Issue Type: Improvement
          Components: Compiler (Java)
    Affects Versions: 0.3
            Reporter: Bryan Duxbury
            Assignee: Bryan Duxbury
             Fix For: 0.3


Each struct's internal _Fields class currently generates and uses a HashMap to allow lookup of enum values by thrift field id. This can be a bit slow - it requires us to box an Integer, then hash it, then perform the lookup. We can probably get by with generating a case statement.

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


[jira] Closed: (THRIFT-753) Don't look up TFieldIdEnum values with a map

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-753?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury closed THRIFT-753.
--------------------------------

    Resolution: Fixed

I just committed this.

> Don't look up TFieldIdEnum values with a map
> --------------------------------------------
>
>                 Key: THRIFT-753
>                 URL: https://issues.apache.org/jira/browse/THRIFT-753
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Compiler (Java)
>    Affects Versions: 0.3
>            Reporter: Bryan Duxbury
>            Assignee: Bryan Duxbury
>             Fix For: 0.3
>
>         Attachments: thrift-753.patch
>
>
> Each struct's internal _Fields class currently generates and uses a HashMap to allow lookup of enum values by thrift field id. This can be a bit slow - it requires us to box an Integer, then hash it, then perform the lookup. We can probably get by with generating a case statement.

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


[jira] Updated: (THRIFT-753) Don't look up TFieldIdEnum values with a map

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-753?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury updated THRIFT-753:
---------------------------------

    Attachment: thrift-753.patch

This patch switches to a switch statement-based lookup. A micro benchmark shows that this new approach is about 10x as fast as the other. This doesn't translate to much of a macro improvement in deserialization, but it does certainly eliminate it outright.

> Don't look up TFieldIdEnum values with a map
> --------------------------------------------
>
>                 Key: THRIFT-753
>                 URL: https://issues.apache.org/jira/browse/THRIFT-753
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Compiler (Java)
>    Affects Versions: 0.3
>            Reporter: Bryan Duxbury
>            Assignee: Bryan Duxbury
>             Fix For: 0.3
>
>         Attachments: thrift-753.patch
>
>
> Each struct's internal _Fields class currently generates and uses a HashMap to allow lookup of enum values by thrift field id. This can be a bit slow - it requires us to box an Integer, then hash it, then perform the lookup. We can probably get by with generating a case statement.

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