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

investigate slow DataInput.skipBytes

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 9.0
    • None
    • None
    • New

    Description

      Currently DataInput has skipBytes(), but IndexInput also adds seek().

      There isn't a clear reason about the differences in the two methods: why would you choose one over the other?

      It causes some performance issues: for example the default implementation actually reads bytes into a byte array and throws everything away. This is really silly for MMapDirectory: skipping bytes should only be a glorified +=.

      So when I look at latest LUCENE-9447 patch, I can't help but think a ton of waste is happening:

      • Maybe skipBytes() is only used because the stored fields compressor interface happens to take DataInput? Should it take IndexInput instead?
      • Should skipBytes() be overridden by MMapDirectory rather than delegating to super? doing real reads and byte array copies isn't free. It should be a += with single bounds check.
      • Should we revisit having DataInput vs IndexInput at all? Maybe they should be collapsed into one thing?

      Attachments

        1. LUCENE-9480.patch
          11 kB
          Greg Miller
        2. LUCENE-9480.patch
          11 kB
          Greg Miller
        3. LUCENE-9480.patch
          14 kB
          Greg Miller

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: