1

I'm storing a Murmur3 64-bit hash as a byte array in a Chronicle bytes object. I trying to sort these keys as fast as physically possible. I implemented quick sort to do that. I noticed there a set of compare and swap methods but nothing for a byte array. Is there anything I can use to speed up my quick sort? Profiling indicated that most pressure is on net.openhft.chronicle.bytes.AbstractBytes.readCheckOffset(long, long, boolean) AbstractBytes.java

Thanks for any hints.

Stefan G
  • 11
  • 1
  • BTW, I noticed switching off assertations (java -disableassertions) increases the performance of 30%. It's maybe worth to mention that in the documentation. – Stefan G Nov 14 '18 at 19:30
  • Assertions should be off by default, I am not sure why you would need to turn them off explicitly. – Peter Lawrey Nov 15 '18 at 13:22

1 Answers1

1

The fastest way to compare two byte[] would be to use Unsafe to read an int or a long from the underlying arrays (and swap the byte order if little endian) This would give you a very fast comparison.

For the most part, Chronicle Bytes is designed to make it either to work with off heap memory though it also supports on heap e.g. byte[].

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130