Proposal: Performance improvements for Data.IntMap

Ian Lynagh igloo at earth.li
Fri Sep 3 12:11:40 EDT 2010


On Tue, Aug 31, 2010 at 03:09:34AM -0700, Donald Bruce Stewart wrote:
> 
> #4279: Proposal: Performance improvements for Data.IntMap
> http://hackage.haskell.org/trac/ghc/ticket/4279

Same .Internals comment as for Data.Map in #4277.

> -        | zero k m      -> let (found,l') = insertLookupWithKey f k x l in (found,Bin p m l' r)
> -        | otherwise     -> let (found,r') = insertLookupWithKey f k x r in (found,Bin p m l r')
> +        | zero k m      = case go l of (found, l') -> (found,Bin p m l' r)
> +        | otherwise     = case go r of (found, r') -> (found,Bin p m l r')

I noticed you didn't convert the let's to case's in Data.Map, in both
insertLookupWithKey and insertLookupWithKey'. Why did you convert them
in IntMap's insertLookupWithKey but not Map?

Likewise updateLookupWithKey.


Unrelated to your changes, but I think it would be worth renaming
foldr' (an internal helper) to avoid confusion.


Thanks
Ian



More information about the Libraries mailing list