Looking at the benchmarks, it seems there is quite a bit of room for improvement in the fingertree
and containers
packages.
I suspect that fingertree
has room for improvement, but containers
is already well optimized. A straightforward thing I see in fingertree
is that all the functions requiring a Measured
constraint could benefit from being INLINABLE
. I have not looked deeper into it though.
They both claim to use the same implementation but containers
is almost always faster, except for the append benchmark.
As mentioned above the benchmarks, it is good to be cautious of the measurements for lazy structures (perhaps I should make it clearer). Looking at the source code, I can see that append is strict for containers
but lazy for fingertree
. So the time for fingertree
cannot directly be compared, it has created thunks which will be forced later.
I also think it would be good to have benchmarks that are centered on use cases rather than the API
This is certainly a good idea. If someone would point me to some good use cases for sequences, I will add them.
As an example, a simple use case for PQueue
is sorting a list, and I added it to the benchmarks when it occurred to me.
A very simple example would be using the sequence as a queue. That sounds like a use case where containers
would perform better than seqn
, because it extensively accesses both ends.
containers
will certainly be better than seqn
for this, because the complexity is better for the relevant operations. The cons/snoc/uncons/unsnoc many
benchmarks make this clear. Though arguably, if one wants a queue, they should use a queue and not a sequence.