Ticket #2329 (closed bug: wontfix)

Opened 5 years ago

Last modified 4 years ago

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 Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

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

Changed 5 years ago by ross

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

Changed 5 years ago by igloo

  • status changed from new to closed
  • difficulty set to Unknown
  • resolution set to wontfix

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

Changed 5 years ago by simonmar

  • architecture changed from Unknown to Unknown/Multiple

Changed 5 years ago by simonmar

  • os changed from Unknown to Unknown/Multiple

Changed 4 years ago by simonmar

  • failure set to Runtime performance bug
Note: See TracTickets for help on using tickets.