Lucene - Core
  1. Lucene - Core
  2. LUCENE-4875

Make SorterTemplate.mergeSort run in linear time on sorted arrays

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.3
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      Through minor modifications, SorterTemplate.mergeSort could run in linear time on sorted arrays, so I think we should do it? The idea is to modify merge so that it returns instantly when compare(pivot-1, pivot) <= 0.

        Activity

        Hide
        Adrien Grand added a comment -

        Patch. I modified the test case to make sure merge is never called when the concatenation of the two runs to merge is already sorted.

        Show
        Adrien Grand added a comment - Patch. I modified the test case to make sure merge is never called when the concatenation of the two runs to merge is already sorted.
        Hide
        Uwe Schindler added a comment -

        Closed after release.

        Show
        Uwe Schindler added a comment - Closed after release.

          People

          • Assignee:
            Adrien Grand
            Reporter:
            Adrien Grand
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development