[Haskell-cafe] Announce: EnumMap-0.0.1

John Van Enk vanenkj at gmail.com
Sun Aug 9 10:21:40 EDT 2009


http://github.com/sw17ch/EnumMap/tree/master

Perhaps you could patch what I have? :)

On Sun, Aug 9, 2009 at 12:08 AM, Thomas
DuBuisson<thomas.dubuisson at gmail.com> wrote:
> Inflating the number of elements in the test, I see:
>
> IntMap
> inserts: 5.3 seconds
> lookups: 2.0 seconds
>
> EnumMap
> inserts: 6.1 sec (15% slower)
> lookups: 2.5 sec (25% slower)
>
> EnumMap with SPECIALIZE of:
> {-# SPECIALIZE join :: Prefix -> EnumMap Int a -> Prefix -> EnumMap
> Int a -> EnumMap Int a #-}
> {-# SPECIALIZE lookup :: Int -> EnumMap Int a -> Maybe a #-}
> {-# SPECIALIZE lookupN :: Nat -> EnumMap Int a -> Maybe a #-}
> {-# SPECIALIZE insert :: Int -> a -> EnumMap Int a -> EnumMap Int a #-}
> inserts: 5.3 seconds (dead on)
> lookups: 2.6 seconds (owch!)
>
> Additionally specializing the functions used in lookup{,N} doesn't
> help.  I tried inlining (via INLINE) a couple things but that only
> made performance notably worse.
>
>
> Thomas
>
> On Sat, Aug 8, 2009 at 8:29 PM, John Van Enk<vanenkj at gmail.com> wrote:
>> How bad is the lookup compared to normal?
>>
>> On Sat, Aug 8, 2009 at 9:02 PM, Thomas
>> DuBuisson<thomas.dubuisson at gmail.com> wrote:
>>> On Sat, Aug 8, 2009 at 5:30 PM, Felipe Lessa<felipe.lessa at gmail.com> wrote:
>>>> On Sat, Aug 08, 2009 at 04:14:15PM -0700, Thomas DuBuisson wrote:
>>>>> There exists a small but measurable performance hit for at least one
>>>>> test case (using Int as keys, obviously).  Perhaps the bias would be
>>>>> the other way if we were comparing EnumMap to an IntMap wrapped with
>>>>> to/from Enum.
>>>>
>>>> Perhaps some SPECIALIZE pragmas would help here.
>>>>
>>>
>>> Actually I tried that by adding SPECIALIZE to insert, insertN and
>>> lookup.  it seemed to make the insert benchmark competitive but not
>>> lookup.
>>>
>>> Thomas
>>> _______________________________________________
>>> Haskell-Cafe mailing list
>>> Haskell-Cafe at haskell.org
>>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>>
>>
>


More information about the Haskell-Cafe mailing list