With this patch I'm seeing a ~39ms improvement (220ms -> 181ms) when
running [hg cat] on ~220 files in a ~260k-file repo.
The timing for [hg cat] on an individual file becomes slightly worse
(losing 5ms: 145ms -> 150ms).
A follow-up commit is intended to improve that.
nit: This is not actually the order they were specified, right? I think it makes the order be sorted. So you could do missing.sort_unstable() instead, I suppose. Or maybe they're already sorted and you don't need to do anything here? (I suspect the code initially didn't have the sorting on line 47.)