You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Erik Holstad (JIRA)" <ji...@apache.org> on 2009/04/22 22:58:47 UTC

[jira] Created: (HBASE-1337) Using byte[] compare instead of long compare when needed to convert to long first.

Using byte[] compare instead of long compare when needed to convert to long first.
----------------------------------------------------------------------------------

                 Key: HBASE-1337
                 URL: https://issues.apache.org/jira/browse/HBASE-1337
             Project: Hadoop HBase
          Issue Type: Improvement
    Affects Versions: 0.20.0
            Reporter: Erik Holstad
            Priority: Minor


When comparing timestamps in the KeyValues tests have shown that it is faster to do a byte[] compare on the timestamps rather than converting to longs and then do the long compare.
In the case where you have one byte[] and one long that you need to compare it is better to convert both to long and do the long compare.
Some numbers:

Compare byte[] to byte[] timer 1042 ns
Compare bytes2long to bytes2long timer 3143 ns
Compare long to long timer 281 ns
bytes2long timer 1328 ns
long2bytes timer 1349 ns

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


[jira] Commented: (HBASE-1337) Using byte[] compare instead of long compare when needed to convert to long first.

Posted by "Erik Holstad (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-1337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12720723#action_12720723 ] 

Erik Holstad commented on HBASE-1337:
-------------------------------------

I think we can, I think it is good for now, we can keep it in mind for going the extra mile when we have everything else under control for like 0.21 or so.

> Using byte[] compare instead of long compare when needed to convert to long first.
> ----------------------------------------------------------------------------------
>
>                 Key: HBASE-1337
>                 URL: https://issues.apache.org/jira/browse/HBASE-1337
>             Project: Hadoop HBase
>          Issue Type: Improvement
>    Affects Versions: 0.20.0
>            Reporter: Erik Holstad
>            Priority: Minor
>
> When comparing timestamps in the KeyValues tests have shown that it is faster to do a byte[] compare on the timestamps rather than converting to longs and then do the long compare.
> In the case where you have one byte[] and one long that you need to compare it is better to convert both to long and do the long compare.
> Some numbers:
> Compare byte[] to byte[] timer 1042 ns
> Compare bytes2long to bytes2long timer 3143 ns
> Compare long to long timer 281 ns
> bytes2long timer 1328 ns
> long2bytes timer 1349 ns

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


[jira] Resolved: (HBASE-1337) Using byte[] compare instead of long compare when needed to convert to long first.

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

stack resolved HBASE-1337.
--------------------------

    Resolution: Fixed

resolving because erik said it's ok


> Using byte[] compare instead of long compare when needed to convert to long first.
> ----------------------------------------------------------------------------------
>
>                 Key: HBASE-1337
>                 URL: https://issues.apache.org/jira/browse/HBASE-1337
>             Project: Hadoop HBase
>          Issue Type: Improvement
>    Affects Versions: 0.20.0
>            Reporter: Erik Holstad
>            Priority: Minor
>
> When comparing timestamps in the KeyValues tests have shown that it is faster to do a byte[] compare on the timestamps rather than converting to longs and then do the long compare.
> In the case where you have one byte[] and one long that you need to compare it is better to convert both to long and do the long compare.
> Some numbers:
> Compare byte[] to byte[] timer 1042 ns
> Compare bytes2long to bytes2long timer 3143 ns
> Compare long to long timer 281 ns
> bytes2long timer 1328 ns
> long2bytes timer 1349 ns

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


[jira] Commented: (HBASE-1337) Using byte[] compare instead of long compare when needed to convert to long first.

Posted by "stack (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-1337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12720556#action_12720556 ] 

stack commented on HBASE-1337:
------------------------------

Can we close this Erik?  You implemented a bunch of long compares this way in 1304.

> Using byte[] compare instead of long compare when needed to convert to long first.
> ----------------------------------------------------------------------------------
>
>                 Key: HBASE-1337
>                 URL: https://issues.apache.org/jira/browse/HBASE-1337
>             Project: Hadoop HBase
>          Issue Type: Improvement
>    Affects Versions: 0.20.0
>            Reporter: Erik Holstad
>            Priority: Minor
>
> When comparing timestamps in the KeyValues tests have shown that it is faster to do a byte[] compare on the timestamps rather than converting to longs and then do the long compare.
> In the case where you have one byte[] and one long that you need to compare it is better to convert both to long and do the long compare.
> Some numbers:
> Compare byte[] to byte[] timer 1042 ns
> Compare bytes2long to bytes2long timer 3143 ns
> Compare long to long timer 281 ns
> bytes2long timer 1328 ns
> long2bytes timer 1349 ns

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