Based on my tests with a few different Oracle and OpenJDK implementations, it seems that Arrays.equals(char[], char[]) is somehow about 8 times fas
I might go out on a limb when suggesting that this is the answer, but according to http://hg.openjdk.java.net/jdk8/jdk8/hotspot/file/9d15b81d5d1b/src/share/vm/classfile/vmSymbols.hpp#l756, the Arrays#equals(char[], char[])
method is implemented as an intrinsic.
Most likely because it is highly performance critical in all string comparisons. <- This was wrong, at least. Surprisingly, String does not use Arrays.equals
for the comparison. But regardless of why it is an intrinsic, this may still be the reason for the performance difference.