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

Remove Arrays.asList().subList() from FSHLog.offer()

VotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 1.0.0, 1.1.0, 2.0.0
    • 1.1.0, 2.0.0
    • wal
    • None

    Description

      while doing a run with a profiler I noticed this:

      FSHLog.java
      void offer(final long sequence, final SyncFuture [] syncFutures, final int syncFutureCount) {
        ...
        this.syncFutures.addAll(Arrays.asList(syncFutures).subList(0, syncFutureCount));
      }
      

      it is creating an Arrays.ArrayList then a RandomAccessSubList,
      and then addAll() is using creating an iterator and call the syncFutures.add() for each item.

      a simpler for loop adding the items directly is not too ugly and it will avoid all this stuff.
      I've attached a simple test to compare the two, it will not make huge difference but since we are in the core path any tiny bit probably helps.

      Attachments

        1. ArrayTest.java
          2 kB
          Matteo Bertozzi
        2. HBASE-13578-v0.patch
          0.9 kB
          Matteo Bertozzi

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            mbertozzi Matteo Bertozzi
            mbertozzi Matteo Bertozzi
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment