You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by roshan <gi...@git.apache.org> on 2015/04/17 11:07:53 UTC

[GitHub] thrift pull request: THRIFT-2877 Generate hashCode using primitive...

GitHub user roshan opened a pull request:

    https://github.com/apache/thrift/pull/447

    THRIFT-2877 Generate hashCode using primitives, static utility methods

    This is pretty much the List.hashCode() except without any list. It takes about a third the time on some rudimentary benchmarks. I tried it out with
    
    ```
    typedef i32 SomeId
    typedef binary BinId
    typedef string StringId
    
    struct NonTrue {}
    
    union MaybeAThing {
        1: NonTrue nt
        2: bool bl
    }
    
    enum Nomnom {
        EAT=31
        LIVE=515
    }
    
    struct AllPrims {
        1: bool boole
        2: byte single_byte
        3: i16 shrt
        4: i32 integ
        5: i64 longue
        6: double f64
        7: string str
        8: binary bin
        9: Nomnom en
        10: NonTrue stru
        11: MaybeAThing un
        12: SomeId intid
        13: BinId binid
        14: StringId strid
    }
    ```
    
    generating [this hashCode()](https://gist.github.com/roshan/7b7fff349e3ed06322c3).
    
    Populating these structs with some values has it match the AbstractList.hashCode() result but maybe we could try a different multiplicative factor.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/roshan/thrift THRIFT-2877_int_based_hashcode

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/447.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #447
    
----
commit f7618aee96061e14b323c653ab36d40158c391c4
Author: Roshan George <ro...@arjie.com>
Date:   2015-04-17T07:46:02Z

    THRIFT-2877 Generate hashCode using primitives and static utility methods

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: THRIFT-2877 Generate hashCode using primitive...

Posted by roshan <gi...@git.apache.org>.
Github user roshan closed the pull request at:

    https://github.com/apache/thrift/pull/447


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---