Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-5750

Speed up monotonic address access in BINARY/SORTED_SET

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 4.9, 6.0
    • None
    • None
    • New

    Description

      I found this while exploring LUCENE-5748, but it currently applies to both variable length BINARY and SORTED_SET, so I think its worth it to do here first.

      I think its just a holdover from before MonotonicBlockPackedWriter that to access element N we currently do:

      startOffset = (docID == 0 ? 0 : ordIndex.get(docID-1));
      endOffset = ordIndex.get(docID);
      

      Thats because previously we didnt have packed ints that supported > Integer.MAX_VALUE elements. But thats been fixed for a long time. If we just write a 0 first and do this:

      startOffset = ordIndex.get(docID);
      endOffset = ordIndex.get(docID+1);
      

      The access is then much faster. For sorting i see around 20% improvement. We don't lose any compression because we should assume the delta from 0 .. 1 is similar to any other gap N .. N+1

      Attachments

        1. LUCENE-5750.patch
          4 kB
          Robert Muir
        2. LUCENE-5750.patch
          4 kB
          Robert Muir

        Activity

          People

            Unassigned Unassigned
            rcmuir Robert Muir
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: