Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-7098

[Java] Improve the performance of comparing two memory blocks

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 0.16.0
    • Java

    Description

      We often use the 8-4-1 paradigm to compare two blocks of memory:
      1. First compare by 8-byte blocks in a loop
      2. Then compare by 4-byte blocks in a loop
      3. Last compare by 1-byte blocks in a loop

      It can be proved that the second loop runs at most once. So we can replace the loop with a if statement, which will save us a comparison and two jump operations.

      According to the discussion in https://github.com/apache/arrow/pull/5508#discussion_r343973982, loop can be expensive.

      Attachments

        Activity

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

          People

            fan_li_ya Liya Fan Assign to me
            fan_li_ya Liya Fan
            Votes:
            0 Vote for this issue
            Watchers:
            2 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 - 50m
                50m

                Slack

                  Issue deployment