[ 
https://issues.apache.org/jira/browse/FLINK-12335?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Liya Fan updated FLINK-12335:
-----------------------------
    Description: 
Improve the performance of class SegmentsUtil:

To evaluate the offset, an integer is bitand with a mask to clear to low bits, 
and then shift right. The bitand is useless:


((index & BIT_BYTE_POSITION_MASK) >>> 3)

  was:
Improve the performance of class SegmentsUtil from two points:

1. In method allocateReuseBytes, the generated byte array should be cached for 
reuse, if the size does not exceed MAX_BYTES_LENGTH. However, the array is not 
cached if bytes.length < length, and this will lead to performance overhead:

if (bytes == null) {
  if (length <= MAX_BYTES_LENGTH) {
    bytes = new byte[MAX_BYTES_LENGTH]; BYTES_LOCAL.set(bytes); 
  }
  else {
    bytes = new byte[length]; 
  }
} else if (bytes.length < length) {
  bytes = new byte[length]; 
}

 

2. To evaluate the offset, an integer is bitand with a mask to clear to low 
bits, and then shift right. The bitand is useless:

 

((index & BIT_BYTE_POSITION_MASK) >>> 3)


> Improvement the performance of class SegmentsUtil
> -------------------------------------------------
>
>                 Key: FLINK-12335
>                 URL: https://issues.apache.org/jira/browse/FLINK-12335
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table SQL / Runtime
>            Reporter: Liya Fan
>            Assignee: Liya Fan
>            Priority: Minor
>
> Improve the performance of class SegmentsUtil:
> To evaluate the offset, an integer is bitand with a mask to clear to low 
> bits, and then shift right. The bitand is useless:
> ((index & BIT_BYTE_POSITION_MASK) >>> 3)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to