[
https://issues.apache.org/jira/browse/THRIFT-511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12711432#action_12711432
]
Dan Kinder commented on THRIFT-511:
-----------------------------------
turns out ruby arrays hash by item, two different arrays with the same elements
have the same hashcode, but otherwise the hashes are very random-looking. Does
it seem like there would be a problem with this?:
def hash
struct_fields.values.sort.hash
end
> 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
>
>
> 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.