Proposal: add chunksOf to Data.Sequence
Mario Blažević
blamario at ciktel.net
Sun May 1 16:43:48 UTC 2016
On 04/25/2016 11:53 PM, David Feuer wrote:
> Last year, I proposed adding chunksOf to Data.Sequence (mimicking the
> functionality of Data.List.Split.chunksOf, and taking advantage of
> internal structure to improve the efficiency beyond anything
> implementable using the current public API). The proposal was met with
> deafening silence. I seek advice and consent of anyone who cares.
I will provide a general comment about Data.Sequence. I don't care much
for it.
While I occasionally use the data type, its performance
characteristics mean that it's rarely what I need. In particular, its
O(log n) complexity of mappend is a killer for many applications. The
problem with Data.Sequence may be that it attempts to be a
jack-of-all-sequences. I can't recall ever needing a fully symmetric
queue. It's nice, I guess, to have a general-purpose data-structure at
hand when prototyping, but a more specialized implementation should
always win in production.
Would you consider adding (and maintaining) a simpler data
structure with O(1) mappend to containers, perhaps something like
https://github.com/nikita-volkov/bytestring-tree-builder/blob/master/library/ByteString/TreeBuilder/Tree.hs
? That is something I'd be reaching for more often that Data.Sequence as
it stands.
More information about the Libraries
mailing list