Is it only me..? Quicksort is supposed to be an algorithm that has O(n) to O(n²) performance and O(n log n) being only an average performance case. Test was made on random data coming from different archs (so I doubt it's characteristic would be remotely identical). Given input size of 50M it means that performance could be between 50M (5e7) up to 2.5e15. That's like performance instability of 8 orders of magnitude.…
You're talking about the complexity of the Quicksort algorithm, whereas the article is about code generation. Both versions sort the same data using the same algorithm. Just a tiny change in the source code caused Clang to generate different machine code. Using different seed values - (srand(1), srand(2), srand(time(NULL))) essentially leads to the same result. With a good choice of pivot, Quicksort is very close to…
It's just rand() in test.c