apurtell commented on a change in pull request #3691:
URL: https://github.com/apache/hbase/pull/3691#discussion_r715793578



##########
File path: 
hbase-common/src/main/java/org/apache/hadoop/hbase/util/UnsafeAccess.java
##########
@@ -471,4 +485,57 @@ public static byte toByte(ByteBuffer buf, int offset) {
   public static byte toByte(Object ref, long offset) {
     return theUnsafe.getByte(ref, offset);
   }
+
+  /**
+   * Zero fill a byte buffer as efficiently as possible.
+   * @param buf the byte buffer
+   */
+  public static void clear(final ByteBuffer buf) {
+    if (buf.isDirect()) {
+      clear(((DirectBuffer)buf).address(), buf.capacity());

Review comment:
       memset doesn't use an 8-byte stride, that is why my version is better. I 
suppose some memsets in some c libraries might try to optimize, but we can't 
depend on that. 




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