As we are not dependent on the ordering, a hash map could improve performance here. As suggested by @sipa.
Consists of a first commit which makes the type easier to change - and should be easy to merge - and a second commit that actually changes the type. This needs benchmarking and extensive testing.