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

MMapDirectory speedups

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1, 4.0-ALPHA
    • Fix Version/s: None
    • Component/s: core/store
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      MMapDirectory has some performance problems:

      1. When the file is larger than Integer.MAX_VALUE, we use MultiMMapIndexInput,
        which does a lot of unnecessary bounds-checks for its buffer-switching etc.
        Instead, like MMapIndexInput, it should rely upon the contract of these operations
        in ByteBuffer (which will do a bounds check always and throw BufferUnderflowException).
        Our 'buffer' is so large (Integer.MAX_VALUE) that its rare this happens and doing
        our own bounds checks just slows things down.
      2. the readInt()/readLong()/readShort() are slow and should just defer to ByteBuffer.readInt(), etc
        This isn't very important since we don't much use these, but I think there's no reason
        users (e.g. codec writers) should have to readBytes() + wrap as bytebuffer + get an
        IntBuffer view when readInt() can be almost as fast...

        Attachments

        1. LUCENE-2816.patch
          4 kB
          Robert Muir

          Activity

            People

            • Assignee:
              rcmuir Robert Muir
              Reporter:
              rcmuir Robert Muir
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: