it makes more sense to get the skinny on the next n
messages, akin to page's cache. but in order to do
that, the next n messages need to be obvious without
poking through the whole pile in order to sort.
This is exactly why IMAPs Thread and Sort extensions are such a big win.
Note that upas wouldn't necessarily have to re-order /mail/fs/mbox in
place. Another possibility would be to have a 'sort' file that you would
write a sort request to, then read to get the list of filenames under
/mail/fs returned ordered by the sort. E.g. if /mail/fs/mbox contains
messages 1, 3 45, and 92,
open /mail/fs/sort
write "recvtime reversed"
read
close
might return "92\n45\n3\n1\n".
There's a lot of room for experimentation here.