Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#2329 closed bug (wontfix)

Control.Parallel.Strategies: definitions of rnf for most collections are poor

Reported by: bos Owned by:
Priority: normal Milestone:
Component: libraries/base Version: 6.8.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

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

Change History (5)

comment:1 Changed 11 years ago by ross

All but IntSet are instances of Foldable, and so have Data.Foldable.foldl'.

comment:2 Changed 11 years ago by igloo

difficulty: Unknown
Resolution: wontfix
Status: newclosed

I'm not sure exactly what changes you're proposing, if any, or if Ross's reply negates them, but please propose them using http://www.haskell.org/haskellwiki/Library_submissions

comment:3 Changed 11 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:4 Changed 11 years ago by simonmar

Operating System: UnknownUnknown/Multiple

comment:5 Changed 10 years ago by simonmar

Type of failure: Runtime performance bug
Note: See TracTickets for help on using tickets.