[ 
https://issues.apache.org/jira/browse/THRIFT-511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12714513#action_12714513
 ] 

Bryan Duxbury commented on THRIFT-511:
--------------------------------------

I tested out this patch's performance difference. Before:

{code}
10
                                    user     system      total        real
string set create               0.000000   0.000000   0.000000 (  0.000143)
struct set create               0.010000   0.000000   0.010000 (  0.003211)
100
                                    user     system      total        real
string set create               0.000000   0.000000   0.000000 (  0.001208)
struct set create               0.330000   0.010000   0.340000 (  0.337008)
1000
                                    user     system      total        real
string set create               0.030000   0.000000   0.030000 (  0.037109)
struct set create              33.420000   0.190000  33.610000 ( 34.300607)
{code}

after:

{code}
10
                                    user     system      total        real
string set create               0.000000   0.000000   0.000000 (  0.000243)
struct set create               0.000000   0.000000   0.000000 (  0.001049)
100
                                    user     system      total        real
string set create               0.010000   0.000000   0.010000 (  0.001654)
struct set create               0.000000   0.000000   0.000000 (  0.006906)
1000
                                    user     system      total        real
string set create               0.040000   0.000000   0.040000 (  0.036426)
struct set create               0.080000   0.000000   0.080000 (  0.090610)
{code}

The performance boost is pretty stark. Also, there's zero testing to be added, 
because verifying that hash codes for == structs before would have worked 
equally well. I think this patch is ready to go.

If no one objects, I will commit it later today.

> Better performing hash method for generated structs
> ---------------------------------------------------
>
>                 Key: THRIFT-511
>                 URL: https://issues.apache.org/jira/browse/THRIFT-511
>             Project: Thrift
>          Issue Type: New Feature
>          Components: Library (Ruby)
>            Reporter: Bryan Duxbury
>            Assignee: Dan Kinder
>             Fix For: 0.2
>
>         Attachments: thrift-511.patch
>
>
> As discussed in THRIFT-231, ruby generated structs' hash code method just 
> always returns zero. While this is semantically correct, it leads to hashes 
> having O(n) performance instead of O(1), which is critical for some 
> applications. 
> We can either take the approach that the Java library uses (optionally 
> produce complex hash function), or just generate a good hash all the time.

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

Reply via email to