You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Jason Brown (Created) (JIRA)" <ji...@apache.org> on 2012/02/21 20:37:46 UTC

[jira] [Created] (CASSANDRA-3938) Optimize autoboxing in ReplayPosition.comparator

Optimize autoboxing in ReplayPosition.comparator
------------------------------------------------

                 Key: CASSANDRA-3938
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-3938
             Project: Cassandra
          Issue Type: Improvement
          Components: Core
    Affects Versions: 1.0.7, 1.1.0
            Reporter: Jason Brown
            Priority: Trivial
             Fix For: 1.1.1
         Attachments: 0001.ReplayPosition-autobox.patch

ReplayPosition.comparator does some unnecessary boxing (and auto-boxing) from primitive int and long to Integer and Long, just to perform a basic numeric comparison. We can just inline the comparison and avoid the conversion to Integer/Long instances. The ReplayPosition.equals() simple looks at the primitive values, so this change would just make the code more parallel.

--
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

        

[jira] [Commented] (CASSANDRA-3938) Optimize autoboxing in ReplayPosition.comparator

Posted by "Jonathan Ellis (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-3938?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13213104#comment-13213104 ] 

Jonathan Ellis commented on CASSANDRA-3938:
-------------------------------------------

Is this really a performance pain point?  Doing a couple box/unboxes per sstable on CL replay doesn't seem like a hot spot to me.  Unless performance is a problem I think the meaning of the code is more clear as it is now.
                
> Optimize autoboxing in ReplayPosition.comparator
> ------------------------------------------------
>
>                 Key: CASSANDRA-3938
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-3938
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.0.7, 1.1.0
>            Reporter: Jason Brown
>            Priority: Trivial
>              Labels: commitlog, replay
>             Fix For: 1.1.1
>
>         Attachments: 0001.ReplayPosition-autobox.patch
>
>
> ReplayPosition.comparator does some unnecessary boxing (and auto-boxing) from primitive int and long to Integer and Long, just to perform a basic numeric comparison. We can just inline the comparison and avoid the conversion to Integer/Long instances. The ReplayPosition.equals() simple looks at the primitive values, so this change would just make the code more parallel.

--
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

        

[jira] [Commented] (CASSANDRA-3938) Optimize autoboxing in ReplayPosition.comparator

Posted by "Jason Brown (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-3938?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13213115#comment-13213115 ] 

Jason Brown commented on CASSANDRA-3938:
----------------------------------------

Nope, this is absolutely not a performance pain point. Just reading through the commit log code as a whole, I stumbled across this. It also seemed slightly inconsistent with the equals() method of the same class which does use the primitives for an equality comparison, and not box to something like:

Long.valueOf(position).equals(that.position).

More than happy to close this ticket with no change. 
                
> Optimize autoboxing in ReplayPosition.comparator
> ------------------------------------------------
>
>                 Key: CASSANDRA-3938
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-3938
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.0.7, 1.1.0
>            Reporter: Jason Brown
>            Priority: Trivial
>              Labels: commitlog, replay
>             Fix For: 1.1.1
>
>         Attachments: 0001.ReplayPosition-autobox.patch
>
>
> ReplayPosition.comparator does some unnecessary boxing (and auto-boxing) from primitive int and long to Integer and Long, just to perform a basic numeric comparison. We can just inline the comparison and avoid the conversion to Integer/Long instances. The ReplayPosition.equals() simple looks at the primitive values, so this change would just make the code more parallel.

--
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

        

[jira] [Updated] (CASSANDRA-3938) Optimize autoboxing in ReplayPosition.comparator

Posted by "Jason Brown (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-3938?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jason Brown updated CASSANDRA-3938:
-----------------------------------

    Attachment: 0001.ReplayPosition-autobox.patch
    
> Optimize autoboxing in ReplayPosition.comparator
> ------------------------------------------------
>
>                 Key: CASSANDRA-3938
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-3938
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.0.7, 1.1.0
>            Reporter: Jason Brown
>            Priority: Trivial
>              Labels: commitlog, replay
>             Fix For: 1.1.1
>
>         Attachments: 0001.ReplayPosition-autobox.patch
>
>
> ReplayPosition.comparator does some unnecessary boxing (and auto-boxing) from primitive int and long to Integer and Long, just to perform a basic numeric comparison. We can just inline the comparison and avoid the conversion to Integer/Long instances. The ReplayPosition.equals() simple looks at the primitive values, so this change would just make the code more parallel.

--
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