For whatever reason there was no notion on that in Performance Characteristics Doc, so I dug into the sources and found out that List and Queue seem to have O(n), since they iterate thru all members. The Vector seems to have O(1), since it simply subtracts one Int from another.
Now, it doesn’t matter whether the collection is append- or prepend-oriented, but either one of them must be O(1), and there’s no need for performant apply.
Is Vector the correct choice? Which would you suggest?
Yes. An alternative would be to create your own immutable wrapper around List, adding its size as constant, but it would be a lot of work if you want to allow all standard collection operations. Stick to
Vector.