[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:       David Menendez <zednenem () psualum ! com>
Date:       2005-01-26 3:59:48
Message-ID: r02010400-1037-B96730126F4E11D9BD09000393758032 () [10 ! 0 ! 1 ! 2]
[Download RAW message or body]

S. Alexander Jacobson writes:

> 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

Two questions I'm currently too lazy to investigate myself:

Does having 'zipped' at the top level mean that the program is keeping
the entire 100,000-element list in memory?

Also, would performance improve if you used Map.fromList? How about
Map.fromAscList?
-- 
David Menendez <zednenem@psualum.com> | "In this house, we obey the laws
<http://www.eyrie.org/~zednenem>      |        of thermodynamics!"

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

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