Ordering is useful for iteration, but if there is a defined order then being able to efficiently jump into the middle of that at a defined point is vital. Think use cases like pagination and such. Unfortunately, OrdMap and OrdSet do not seem to support this natively. The only option seems to be iter().skip() or iter().nth(), which I think are O(n) as as far as I can tell they work by visiting every node in sequence. Seems to me like it should be possible to speed this up significantly. Potentially both iter.skip and iter.nth could be accelerated, as well as providing APIs to convert a key to an index and get a key/value by index.
Ordering is useful for iteration, but if there is a defined order then being able to efficiently jump into the middle of that at a defined point is vital. Think use cases like pagination and such. Unfortunately, OrdMap and OrdSet do not seem to support this natively. The only option seems to be iter().skip() or iter().nth(), which I think are O(n) as as far as I can tell they work by visiting every node in sequence. Seems to me like it should be possible to speed this up significantly. Potentially both iter.skip and iter.nth could be accelerated, as well as providing APIs to convert a key to an index and get a key/value by index.