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

Uwe Schindler commented on LUCENE-3654:
---------------------------------------

I agree here, but before doing this, I want some non-micro-benchmarks to show 
the effect. If there is no real effect, don't do it. Inside Lucene the 
comparator is not so often used (mostly only in indexer/BytesRefHash) and in 
TermRangeQuery. The other use cases are asserts all over the place, but they 
don't count.

I would agree to the patch if the class would be renamed to something like 
UnsignedBytesComparator and the part importing sun.misc.Unsafe to be outside 
the main compilation unit. So if somebody compiles with a strange JVM like 
Harmony (although its dead) and sun.misc.Unsafe is not available, the build 
succeeds. The code in BytesRef is using reflection to load the comparator 
implementation, so all is fine, it would just get ClassNotFoundEx and fallback 
to the Java one. I could help in doing the ANT magic.
                
> Optimize BytesRef comparator to use Unsafe long based comparison (when 
> possible)
> --------------------------------------------------------------------------------
>
>                 Key: LUCENE-3654
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3654
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: core/index, core/search
>            Reporter: Shay Banon
>         Attachments: LUCENE-3654.patch
>
>
> Inspire by Google Guava UnsignedBytes lexi comparator, that uses unsafe to do 
> long based comparisons over the bytes instead of one by one (which yields 
> 2-4x better perf), use similar logic in BytesRef comparator. The code was 
> adapted to support offset/length.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to