GitHub user roshan opened a pull request:

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

    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.
    
    Sorry about the other one https://github.com/apache/thrift/pull/447. I 
rebased to one commit, but couldn't seem to reuse the old PR (it compiled 
locally on gcc but failed on clang).

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/448.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 #448
    
----
commit b436a7ef56f5e6744d1004b284efa7b1d64b375b
Author: Roshan George <ros...@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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to