Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-3495 [Java] Optimize bit operations performance
  3. ARROW-3891

[Java] Remove Long.bitCount with simple bitmap operations

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.12.0
    • Java

    Description

      the `public int isSet(int index)` routine checks if the bit is set by calling Long.bitCount function. This is unnecessary and creates performance degradation. This can simply be replaced by bit shift and bitwise & operation. 

      `return Long.bitCount(b & (1L << bitIndex));`

      to 

      `return (b >> bitIndex) & 0x01;` 

      Attachments

        Issue Links

          Activity

            People

              atrivedi Animesh Trivedi
              atrivedi Animesh Trivedi
              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 - 50m
                  50m