Lucene - Core
  1. Lucene - Core
  2. LUCENE-2006

Optimization for FieldDocSortedHitQueue

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 3.0
    • Component/s: core/search
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      When updating core for generics, I found the following as a optimization of FieldDocSortedHitQueue:

      All FieldDoc values are Compareables (also the score or docid, if they
      appear as SortField in a MultiSearcher or ParallelMultiSearcher). The code
      of lessThan seems very ineffective, as it has a big switch statement on the
      SortField type, then casts the value to the underlying numeric type Object,
      calls Number.xxxValue() & co for it and then compares manually. As
      j.l.Number is itself Comparable, I see no reason to do this. Just call
      compareTo on the Comparable interface and we are happy. The big deal is that
      it prevents casting and the two method calls xxxValue(), as Number.compareTo
      works more efficient internally.

      The only special cases are String sort, where the Locale may be used and the
      score sorting which is backwards. But these are two if statements instead of
      the whole switch.

      I had not tested it now for performance, but in my opinion it should be
      faster for MultiSearchers. All tests still pass (because they should).

      1. LUCENE-2006.patch
        4 kB
        Uwe Schindler

        Activity

        Uwe Schindler created issue -
        Uwe Schindler made changes -
        Field Original Value New Value
        Attachment LUCENE-2006.patch [ 12423053 ]
        Uwe Schindler made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Uwe Schindler made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Workflow jira [ 12480311 ] Default workflow, editable Closed status [ 12563634 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12563634 ] jira [ 12585209 ]

          People

          • Assignee:
            Uwe Schindler
            Reporter:
            Uwe Schindler
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development