[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell-cafe
Subject:    Re: [Haskell-cafe] using Map rather than FiniteMap
From:       "S. Alexander Jacobson" <alex () alexjacobson ! com>
Date:       2005-01-25 23:26:43
Message-ID: Pine.WNT.4.61.0501251632110.1272 () philo
[Download RAW message or body]

Oops.  It pays to check your checking code before 
making posts like this.

After actually running the correct test, I am 
still getting semi-ridiculous space behavior 
(6k/pair)!

    import qualified Map
    zipped =zip [1..] [1..100000]::[(Int,Int)]
    untup f (x,y) = f x y
    produce = foldr (untup Map.insert) Map.empty zipped
    fm = length  $ Map.keys produce
    main = print $ fm

Has this profile:

 	   example +RTS -p -K5M -RTS

 	total time  =        5.10 secs   (255 ticks @ 20 ms)
 	total alloc = 612,534,236 bytes  (excludes profiling overheads)

    	COST CENTRE                    MODULE               %time %alloc
 	balance                        Map                   71.8   72.8
 	insert                         Map                   12.2   10.8
 	size                           Map                    9.0    9.7
 	bin                            Map                    2.4    2.2
 	rotateR                        Map                    1.6    0.3
 	zipped                         Main                   0.8    1.9

Notice the 612Mb for storing a mapping from Int 
to Int!!

Also 5M of stack is required to make this work.

Can anyone help?

-Alex-

______________________________________________________________
S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com


On Tue, 25 Jan 2005, Jorge Adriano Aires wrote:

>
>> Just did a search after my last post and learned
>> that FiniteMap is bad.  Discoverd that Data.Map is
>> the intended replacement.  Downloaded it and
>> modified it to work with 6.2.  Blazingly fast!
>>
>> Yay.
>
> Hi, just curious,
> How much trouble was getting it to work with ghc 6.2 and adapting your program
> to use the API of Data.Map instead of Data.FiniteMap?
>
> J.A.
>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic