29 Aug 2010 15:34
Proposal: Add strict versions of foldlWithKey and insertLookupWithKey to Data.Map
Johan Tibell <johan.tibell <at> gmail.com>
2010-08-29 13:34:29 GMT
2010-08-29 13:34:29 GMT
http://hackage.haskell.org/trac/ghc/ticket/4278
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.
Proposal: Add strict versions of foldlWithKey and insertLookupWithKey to Data.Map
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.
_______________________________________________ Libraries mailing list Libraries <at> haskell.org http://www.haskell.org/mailman/listinfo/libraries
RSS Feed