When the internal and archived phase was added, allphases became sparse
populated. This dramatically increased the number of lookup operations
for public revisions when they hit phasecache.phase as it it is
iterationing over all phases in the phasesets. Fix this by making the
various data structures either sparse lists or dictionaries, depending
on the purpose. Push the node->revision mapping down into the C module,
no need to do it in Python when it is as much work in the backend.
Document the inconsistency of phaseroots and how it breaks the parent
lookup shortcut.
Overall, this improves a no-change "hg up" for my NetBSD test
repository from 4.7s to 1.3s.
nit: you could directly iterate on the values