You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Jonathan Ellis (Issue Comment Edited) (JIRA)" <ji...@apache.org> on 2012/04/16 22:36:18 UTC

[jira] [Issue Comment Edited] (CASSANDRA-4152) cache the hashcode of DecoratedKey as it is immutable

    [ https://issues.apache.org/jira/browse/CASSANDRA-4152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13255010#comment-13255010 ] 

Jonathan Ellis edited comment on CASSANDRA-4152 at 4/16/12 8:36 PM:
--------------------------------------------------------------------

Agreed that it's not obvious this is a good trade to make.  We use DK all over the place, so expanding its memory footprint makes me cautious.  Also, a lot of the collections it's used in rely on comparator instead of hash.

That said, if you have profiled a path that shows this to be a bottleneck, I'm very interested.
                
      was (Author: jbellis):
    Agreed that it's not obvious this is a good trade to make.  We use DK all over the place, so expanding its memory footprint makes me cautious.  Also, a lot of the collections it's used in rely on comparator instead of hash.
                  
> cache the hashcode of DecoratedKey as it is immutable
> -----------------------------------------------------
>
>                 Key: CASSANDRA-4152
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4152
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Dave Brosius
>            Priority: Trivial
>         Attachments: cache_decoratedkey_hash.diff
>
>
> cache the hashcode of the DecoratedKey on first hashCode() call. DecoratedKey is immutable so no need to run thru all ByteBuffer bytes of the key and do hashcode math. 
> applied to trunk.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira