Do a merge sort for the hooks at the end of the backup, so as to
use less memory.