In C++, given vector<T> src, dst, both already sorted, is there a more efficient way to merge the contents of src into dst than
size_t n = dst.size();
dst.insert(dst.end(), src.begin(), src.end());
std::inplace_merge(dst.begin(), dst.begin() + n, dst.end());
? In the case I care about, T is a small (12-16 bytes, depending on ABI) POD structure, but each vector contains millions of elements, so the total amount of memory in play is tens to hundreds of megabytes.
I would at least try:
But I suspect that much depends on the nature of
T, the size ofsrcanddst, and why we need to optimize.