Currently I need an immutable data structure (indexed by Int) that has fast read and update (basically, effectively O(1)), but somewhat slower cons (such as O(logn)) is acceptable. Other operations are not necessary. What I have now are:
Data.IntMapwhich is a radix tree. It has asymptotic O(1) for everything and is currently the best choice.Data.Sequencewhich is a finger tree. It has worst-case O(logn) lookup/update but O(1) cons. That is not quite in line with my need and indeed performs worse thenIntMaps in my microbenchmarks.Data.HashMaphas O(logn) for everything and performs worse thanIntMap.
My question is: is there any Haskell data structures that can perform better than IntMap in this regard?