lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dawid Weiss (Commented) (JIRA)" <>
Subject [jira] [Commented] (LUCENE-3654) Optimize BytesRef comparator to use Unsafe long based comparison (when possible)
Date Wed, 21 Dec 2011 08:17:30 GMT


Dawid Weiss commented on LUCENE-3654:

There's been an interesting discussion about the common use of Unsafe on hotspot mailing list
recently (can't recall the thread now though). Some people even wanted Unsafe to become part
of standard library (not unsafe accesses -- the lock checking part, but nonetheless). This
guy wrote an entire off-heap collections library on top of Unsafe:

I think using Unsafe with a fallback is fine, especially in small-scope methods that are used
frequently and can be thoroughly tested. BytesRef is such an example to me.

This said, it would certainly help to convince Robert and others if you ran benchmarks alongside
with and without Unsafe and show how much there is to gain, Shay.
> Optimize BytesRef comparator to use Unsafe long based comparison (when possible)
> --------------------------------------------------------------------------------
>                 Key: LUCENE-3654
>                 URL:
>             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:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message