haridsv commented on code in PR #7584:
URL: https://github.com/apache/hbase/pull/7584#discussion_r2670974527


##########
hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java:
##########
@@ -1694,10 +1694,23 @@ public static byte[] add(final byte[] a, final byte[] 
b) {
    * @return New array made from a, b and c
    */
   public static byte[] add(final byte[] a, final byte[] b, final byte[] c) {
-    byte[] result = new byte[a.length + b.length + c.length];
+    return add(a, b, c, EMPTY_BYTE_ARRAY);
+  }
+
+  /**
+   * Concatenate byte arrays.
+   * @param a first fourth
+   * @param b second fourth
+   * @param c third fourth
+   * @param d fourth fourth
+   * @return New array made from a, b, c, and d
+   */
+  public static byte[] add(final byte[] a, final byte[] b, final byte[] c, 
final byte[] d) {

Review Comment:
   Your suggestion is possible, in fact from this angle the current 3 param 
variant can also be done using the 2 param variant, but I would assume that a 
dedicated method was created to make it more efficient and produces less 
garbage, so I extended the same philosophy to the new 4 param variant. IMHO, 
the duplication is worth having from the point of squeezing out additional 
performance.



-- 
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]

Reply via email to