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

CopyBytes now saves one memory copy on ByteBuffersDataOutput

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 9.3
    • core/store
    • None
    • New

    Description

      This is derived from [LUCENE-10627|https://github.com/apache/lucene/pull/987]

      Code: https://github.com/apache/lucene/pull/1034 

      The abstract method `copyBytes` in DataOutput have to copy from input to a copyBuffer and then write into ByteBuffersDataOutput.blocks, i think there is unnecessary, we can override it, copy directly from input into output.

      with override this method,

      1. Reduce memory copy in `Lucene90CompressingStoredFieldsWriter#copyOneDoc` -> `bufferdDocs.copyBytes(DataInput input)`
      2. Reduce memory copy in `Lucene90CompoundFormat.writeCompoundFile` -> `data.copyBytes` when input is `BufferedChecksumIndexinput` and output is `ByteBuffersDataOutput`
      3. Reduce memory `IndexWriter#copySegmentAsIs` ->CopyFrom -> copyBytes

       
       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              luyuncheng LuYunCheng
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h
                  2h