Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.21.0
-
None
-
None
-
Reviewed
Description
KeyValueLineRecordReader effects the copy from the line to the key/value by creating separate arrays:
int keyLen = pos; byte[] keyBytes = new byte[keyLen]; System.arraycopy(line, 0, keyBytes, 0, keyLen); int valLen = lineLen - keyLen - 1; byte[] valBytes = new byte[valLen]; System.arraycopy(line, pos + 1, valBytes, 0, valLen); key.set(keyBytes); value.set(valBytes);
Since set triggers another copy and Text has a set taking byte[], off, len, the intermediate copy can be avoided