You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Charlie Helin (JIRA)" <ji...@apache.org> on 2014/11/07 21:22:35 UTC
[jira] [Created] (ZOOKEEPER-2075) Utils.bufEquals
Charlie Helin created ZOOKEEPER-2075:
----------------------------------------
Summary: Utils.bufEquals
Key: ZOOKEEPER-2075
URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2075
Project: ZooKeeper
Issue Type: Bug
Components: java client
Affects Versions: 3.4.6
Reporter: Charlie Helin
Just happened to notice Utils.bufEquals(byte[], byte[]) as a rather large outlier (~7% CPU time) when running with an attached profiler.
By just simply switching the implementation to delegate directly to Arrays.equals(byte[], byte[]) the invocation disappears from the profile. The reason for this is that this is one of the methods which the JIT (not the interpreter) will generate an intrinsic for, using the builtin support of the CPU to do the check.
The fix is trivial
{code}
public static boolean bufEquals(byte onearray[], byte twoarray[] ) {
return Arrays.equals(onearray, twoarray);
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)