[ 
https://issues.apache.org/jira/browse/AVRO-939?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eli Reisman updated AVRO-939:
-----------------------------

    Affects Version/s: 1.7.1
               Status: Patch Available  (was: Open)

First version, I am fairly certain this uses the Guava Lexicographical byte 
comparator without any undue byte[] copying, but in order to support indexed 
comparisons in BinaryData#compareBytes() I do have to wrap the inputs in 
ByteBuffers temporarily.

This does not make me happy, but did seem the the only way to do this? As long 
as we aren't copying our byte[] arguments, the use of the static ByteBuffer 
methods to wrap and slice the byte[] inputs down to indexed sizes is probably 
not too inefficient compared to the gains we get from the Guava (sun Unsafe 
based) comparator? Any thoughts? Is there a better way?

                
> Java: optimize BinaryData#compareBytes() to use sun.misc.Unsafe when available
> ------------------------------------------------------------------------------
>
>                 Key: AVRO-939
>                 URL: https://issues.apache.org/jira/browse/AVRO-939
>             Project: Avro
>          Issue Type: New Feature
>          Components: java
>    Affects Versions: 1.7.1
>            Reporter: Doug Cutting
>         Attachments: AVRO-939-1.patch
>
>
> Google's Guava libraries include an optimized implementation of lexicographic 
> byte comparison based on sun.misc.Unsafe that's ~4x faster than the normal 
> Java implementation.
> http://hiroshiyamauchi.blogspot.com/2010/08/fast-unsigned-byte-lexicographical.html
> http://www.google.com/codesearch#UKMs0lhE9bg/trunk/src/com/google/common/primitives/UnsignedBytes.java&l=276
> We might similarly optimize BinaryData#compareBytes().

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

        

Reply via email to