Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-17233

See if we should replace System.arrayCopy with Arrays.copyOfRange

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0.0
    • None
    • None
    • None

    Description

      Just saw this interesting comment in PB code. Since we deal with byte[] extensively (when we are onheap) we do lot of copies too.

      * <p>One of the noticeable costs of copying a byte[] into a new array using
         * {@code System.arraycopy} is nullification of a new buffer before the copy. It has been shown
         * the Hotspot VM is capable to intrisicfy {@code Arrays.copyOfRange} operation to avoid this
         * expensive nullification and provide substantial performance gain. Unfortunately this does not
         * hold on Android runtimes and could make the copy slightly slower due to additional code in
         * the {@code Arrays.copyOfRange}. 
      

      So since we are hotspot VM we could see if the places we use System.arrayCopy can be replaced with Arrays.copyOfRange.

      Attachments

        Activity

          People

            ram_krish ramkrishna.s.vasudevan
            ram_krish ramkrishna.s.vasudevan
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated: