How to implement Data.Map.insertList*?
daan at cs.uu.nl
Thu Feb 24 05:49:24 EST 2005
Mirko Rahn wrote:
> These terms are hard to compare but a plot shows that insertList_foldl
> should be faster than insertList_union.
> But a testprogram shows that insertList_union is faster (and needs less
> memory) whatever the sizes of n and m are.
> So my questions are:
> Why are the insertList* functions missing?
Just my laziness :) Maybe someone can add them to the libraries?
> How would the library implementors implement insertList* and why?
I think I would use the "union" version as it is the simplest.
However, since the "foldl'" version seems faster, maybe one should
use that anyway. (Be careful though -- the union on IntMap's is
very fast -- it'll be hard to beat that even using foldl').
More information about the Libraries