chrka
Joined 1 year ago
Karma
186
Submissions
51
Member since
Apr 8
[email protected]
View on Hacker NewsJoined 1 year ago
You type: radius=10<enter>gc<tab><tab>50 50 r<tab><shift-enter> And right away, you have a circle on the screen.
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 O(n log n) in practice, so that’s not the key factor here.
The interesting thing is that the generated machine code changes significantly.