keith-turner commented on code in PR #4735:
URL: https://github.com/apache/accumulo/pull/4735#discussion_r1676242002
##########
core/src/main/java/org/apache/accumulo/core/data/ArrayByteSequence.java:
##########
@@ -154,6 +154,15 @@ public int offset() {
return offset;
}
+ /**
+ * Reset the backing array for this byte sequence object. This is useful for
object re-use.
+ */
+ public void reset(byte[] data) {
Review Comment:
There are two big differences between Text and ArrayByteSequence.
* Text always copies when an array is set on it. So when doing something
like `Text row = key.getRow()` it will allocate a byte array, copy the row into
it, and then allocate a text object.. This will not copy the row byte array
`ByteSequence row = key.getRowData()`, it will only allocate an
ArrayByteSequence object.
* ArrayByteSequence can refer to a subsequence of a byte array that starts
a position other than zero. Text always assume 0 start.
The interesting thing about the changes in this PR is that filtering on
visibility could do zero object allocations for the common case. This would
not be possible with Text, it will always allocate a byte array and copy.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]