ByteBuf Comparsions

32 views
Skip to first unread message

Domas Vinci

unread,
Sep 12, 2023, 11:56:57 AM9/12/23
to Netty discussions
Hello,

We have a need to quickly compare buffers to see if they are identical and it often can occur that their size will be ==.

In our benchmarks we noted that Arrays.equals() is much faster due to vectorization, but we understand that there might be some dangers comparing the underlying arrays? We are aware that not all bytebuffs are array backed, but in our case we compare only UnpooledUnsafeHeapByteBuf.

How dangerous would it be to use Arrays.equals? Are there better ways to compare buffers staying within safe realm?

Regards
Reply all
Reply to author
Forward
0 new messages