Ticket #2645 (closed proposal: fixed)

Opened 5 years ago

Last modified 4 years ago

fix type, performance of IntMap(Set).findMin(Max)

Reported by: sedillard Owned by: igloo
Priority: normal Milestone: Not GHC
Component: libraries (other) Version: 6.8.3
Keywords: containers Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

The findMin / findMax functions for Data.IntMap? currently return only the bound value, not the key, as is the case for Data.Map.findMin.

These read-only queries are implemented using maxView which modifies the tree along the path from the root to the leaf, burning heap unnecessarily. I've provided a patch to implement these as simple recursive loops, as is done with Data.Map.

Both of these issues impact the performance and usability of IntMaps? when employed as purely functional arrays, maps from arbitrary ints to values. In this use case, I need to know what the range of used "addresses" is, so I can assign new ones for quickly appending items onto the front or back of the array, or offsetting the keys of one array before unioning it with another.

See list post :  http://www.haskell.org/pipermail/libraries/2008-May/009687.html

Attachments

IntMap_IntSet_findMin_findMax.patch Download (2.6 KB) - added by sedillard 5 years ago.

Change History

Changed 5 years ago by sedillard

Changed 5 years ago by igloo

  • difficulty set to Unknown
  • milestone set to Not GHC

Changed 4 years ago by igloo

  • owner set to igloo

Changed 4 years ago by igloo

  • status changed from new to closed
  • resolution set to fixed

Applied, thanks!

Note: See TracTickets for help on using tickets.