Improve merging performance for sort reducing

O(n * m) ->
O(n + m)