Proposal: Add strict versions of foldlWithKey and insertLookupWithKey to Data.Map

Thomas Schilling nominolo at googlemail.com
Thu Sep 2 21:00:13 EDT 2010


+1

On 29 August 2010 14:34, Johan Tibell <johan.tibell at gmail.com> wrote:
> http://hackage.haskell.org/trac/ghc/ticket/4278
> Proposal: Add strict versions of foldlWithKey and insertLookupWithKey to
> Data.Map
> This proposal depends on #4277 [1].
>
> The current Data.Map API lacks two important functions:
>
>     * A strict left (pre-order) fold -- needed to e.g. sum all the values in
> a map efficiently.
>
>     * A strict insertLookupWithKey' -- needed to e.g. update an integer
> counter and retrieve the previous value in a single traversal.
>
> The benchmark we ran indicates that foldlWithKey' is 95% faster than its
> lazy counter part.insertLookupWithKey' is only 6% faster, but the speedup is
> highly dependent on how many times each element is update. Each element was
> only updated once in our benchmark so real speedups should be larger.
>
> The consideration period is 3 weeks.
>
> 1. http://hackage.haskell.org/trac/ghc/ticket/4277
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
>



-- 
If it looks like a duck, and quacks like a duck, we have at least to
consider the possibility that we have a small aquatic bird of the
family Anatidae on our hands.


More information about the Libraries mailing list