[GHC] #2329: Control.Parallel.Strategies: definitions of rnf for
most collections are poor
GHC
trac at galois.com
Mon Jun 2 12:09:55 EDT 2008
#2329: Control.Parallel.Strategies: definitions of rnf for most collections are
poor
-----------------------------------------+----------------------------------
Reporter: bos | Owner:
Type: run-time performance bug | Status: new
Priority: normal | Component: libraries/base
Version: 6.8.2 | Severity: normal
Keywords: | Testcase:
Architecture: Unknown | Os: Unknown
-----------------------------------------+----------------------------------
These all perform a lot of consing, which seems rather undesirable. It
would be very nice indeed if they could be rebaked in terms of strict left
folds. Unfortunately, all of the collections in question seem only to
expose non-strict left folds publicly.
{{{
instance (NFData k, NFData a) => NFData (Data.Map.Map k a) where
rnf = rnf . Data.Map.toList
instance NFData a => NFData (Data.Set.Set a) where
rnf = rnf . Data.Set.toList
instance NFData a => NFData (Data.Tree.Tree a) where
rnf (Data.Tree.Node r f) = rnf r `seq` rnf f
instance NFData a => NFData (Data.IntMap.IntMap a) where
rnf = rnf . Data.IntMap.toList
instance NFData Data.IntSet.IntSet where
rnf = rnf . Data.IntSet.toList
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2329>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list