2012-04-29, 06:21 PM
Hmm. So, is it just slower by a constant factor? It looks to me like you're doing maybe ~4 times as many array accesses as you need to, so you could speed it up by a small constant factor by being a bit more clever (e.g. by storing A[from] in a temporary variable and eliminating some unnecessary swaps).
But I don't see anything fundamentally wrong here that would make it more than about 10x slower than it should.
Also is the merge sort you're comparing to one that you wrote in Java too?
But I don't see anything fundamentally wrong here that would make it more than about 10x slower than it should.
Also is the merge sort you're comparing to one that you wrote in Java too?

