More optimizations for better performance

This new version uses a modified binary insertion sort at the start for
better performance in some cases, then it uses a trick where two A+B
pairs are merged into the cache at the same time, then the pairs are
merged back into the original array. This ended up improving the
performance a lot!