Add a time-optimized MergeSort implementation in JavaScript