Does anyone want intersperse for Data.Sequence?

Ross Paterson R.Paterson at city.ac.uk
Mon Dec 29 16:09:01 UTC 2014


On Sun, Dec 28, 2014 at 11:01:46AM +0200, Roman Cheplyaka wrote:
> On 27/12/14 17:03, Greg Weber wrote:
> > Sequence is not used nearly enough.
> 
> Not really. Seq has high constant factors and for small sizes is often
> slower than plain lists. Nor is it space-efficient (for big sizes).

Clearly Seq uses more space than arrays, but I estimate that a large
Seq uses between 5/6 and 4/3 of the space of an equivalent list,
with Seq's built with deque operations tending toward the lower end
and append/split moving them toward the middle of the range.  So I'd
say they're about the same (unless the list is deforested, of course).
Do you have measurements that give different results?

> It probably has its use cases, but most of the time you'd be better off
> with one of the other choices:

Those choices will beat Seq on particular operation mixes, but the virtue
of Seq is that it gives decent performance over a broad set of operations.


More information about the Libraries mailing list