[] arr; @Setup public void setup() { arr = new byte[count]; Random random = new Random(1234); random.nextBytes(arr); } } @Benchmark public byte[] measureWrong(Data d) { bubbleSort(d.arr); return d.arr; } /* * The method above is subtly wrong: it sorts the random array on...
Implement sorts & know best case/worst case, average complexity of each: no bubble sort - it's terrible - O(n^2), except when n <= 16 stability in sorting algorithms ("Is Quicksort stable?") Sorting Algorithm Stability Stability In Sorting Algorithms Stability In Sorting Algorithms Sor...
So you really do need to have a small, tight battery, efficient, all those sorts of things. And so yeah, I don’t do you. And so that’s something you basically are right in the same code. And then the compiler is kind of handling that depending on where you’re deploying. [...