You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Chad Walters (JIRA)" <ji...@apache.org> on 2010/01/14 06:16:55 UTC

[jira] Created: (THRIFT-675) Generated findByValue() should just switch on value instead of mapping

Generated findByValue() should just switch on value instead of mapping
----------------------------------------------------------------------

                 Key: THRIFT-675
                 URL: https://issues.apache.org/jira/browse/THRIFT-675
             Project: Thrift
          Issue Type: Improvement
          Components: Compiler (Java)
    Affects Versions: 0.2
            Reporter: Chad Walters


Generated enum classes currently use a map in findByValue() to go from an integer value to an enum.

Instead of using a map, it is faster to simply switch on the value with a default case returning null.

On some benchmarks I ran, this saved 7% of deserialization time.

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


[jira] Commented: (THRIFT-675) Generated findByValue() should just switch on value instead of mapping

Posted by "Chad Walters (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12801071#action_12801071 ] 

Chad Walters commented on THRIFT-675:
-------------------------------------

Looks good to me.



> Generated findByValue() should just switch on value instead of mapping
> ----------------------------------------------------------------------
>
>                 Key: THRIFT-675
>                 URL: https://issues.apache.org/jira/browse/THRIFT-675
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Compiler (Java)
>    Affects Versions: 0.2
>            Reporter: Chad Walters
>            Assignee: Bryan Duxbury
>         Attachments: thrift-675.patch
>
>
> Generated enum classes currently use a map in findByValue() to go from an integer value to an enum.
> Instead of using a map, it is faster to simply switch on the value with a default case returning null.
> On some benchmarks I ran, this saved 7% of deserialization time.

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


[jira] Updated: (THRIFT-675) Generated findByValue() should just switch on value instead of mapping

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

Bryan Duxbury updated THRIFT-675:
---------------------------------

    Attachment: thrift-675.patch

This goes back to switch statements. How's it do in your benchmarks?

> Generated findByValue() should just switch on value instead of mapping
> ----------------------------------------------------------------------
>
>                 Key: THRIFT-675
>                 URL: https://issues.apache.org/jira/browse/THRIFT-675
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Compiler (Java)
>    Affects Versions: 0.2
>            Reporter: Chad Walters
>            Assignee: Bryan Duxbury
>         Attachments: thrift-675.patch
>
>
> Generated enum classes currently use a map in findByValue() to go from an integer value to an enum.
> Instead of using a map, it is faster to simply switch on the value with a default case returning null.
> On some benchmarks I ran, this saved 7% of deserialization time.

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


[jira] Assigned: (THRIFT-675) Generated findByValue() should just switch on value instead of mapping

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

Bryan Duxbury reassigned THRIFT-675:
------------------------------------

    Assignee: Bryan Duxbury

> Generated findByValue() should just switch on value instead of mapping
> ----------------------------------------------------------------------
>
>                 Key: THRIFT-675
>                 URL: https://issues.apache.org/jira/browse/THRIFT-675
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Compiler (Java)
>    Affects Versions: 0.2
>            Reporter: Chad Walters
>            Assignee: Bryan Duxbury
>
> Generated enum classes currently use a map in findByValue() to go from an integer value to an enum.
> Instead of using a map, it is faster to simply switch on the value with a default case returning null.
> On some benchmarks I ran, this saved 7% of deserialization time.

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


[jira] Resolved: (THRIFT-675) Generated findByValue() should just switch on value instead of mapping

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

Bryan Duxbury resolved THRIFT-675.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 0.3

I just committed this.

> Generated findByValue() should just switch on value instead of mapping
> ----------------------------------------------------------------------
>
>                 Key: THRIFT-675
>                 URL: https://issues.apache.org/jira/browse/THRIFT-675
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Compiler (Java)
>    Affects Versions: 0.2
>            Reporter: Chad Walters
>            Assignee: Bryan Duxbury
>             Fix For: 0.3
>
>         Attachments: thrift-675.patch
>
>
> Generated enum classes currently use a map in findByValue() to go from an integer value to an enum.
> Instead of using a map, it is faster to simply switch on the value with a default case returning null.
> On some benchmarks I ran, this saved 7% of deserialization time.

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