[
https://issues.apache.org/jira/browse/LUCENE-3654?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13173971#comment-13173971
]
Robert Muir commented on LUCENE-3654:
-------------------------------------
Here's an example, since so much of the lucene codebase has bugs with bytesref
offsets, i figure its a good example:
{noformat}
public void testOops() {
BytesRef b = new BytesRef("abcdefghijklmnop");
b.offset = -545454544; // some bug, integer overflows and goes negative or
other problem
System.out.println(b.compareTo(new BytesRef("abcdefghijklmnop")));
}
{noformat}
With this patch, this gives me a SIGSEGV:
{noformat}
junit-sequential:
[junit] Testsuite: org.apache.lucene.util.TestBytesRef
[junit] #
[junit] # A fatal error has been detected by the Java Runtime Environment:
[junit] #
[junit] # SIGSEGV (0xb) at pc=0x00007f386e7dcf64, pid=6093,
tid=139880338200320
[junit] #
[junit] # JRE version: 6.0_24-b07
[junit] # Java VM: Java HotSpot(TM) 64-Bit Server VM (19.1-b02 mixed mode
linux-amd64 compressed oops)
[junit] # Problematic frame:
[junit] # V [libjvm.so+0x76ef64]
[junit] #
{noformat}
> 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]