[Haskell-cafe] [Newbie] Problem with Data.Map (or something else ?)

Bruno Carnazzi bcarnazzi at gmail.com
Mon Mar 31 12:50:26 EDT 2008


The program ends for values up to 400000 :

*Main> :set +s
*Main> maxChain 1000
(871,179)
(0.09 secs, 3697648 bytes)
*Main> maxChain 10000
(6171,262)
(0.73 secs, 31560008 bytes)
*Main> maxChain 100000
(77031,351)
(9.31 secs, 347122064 bytes)
*Main> maxChain 200000
(156159,383)
(19.32 secs, 709303708 bytes)

<< This one take about 10 minutes and swap a lot >>
*Main> maxChain 300000
(230631,443)
(38.02 secs, 1083800124 bytes)

<< This one swap a lot and does not end in less than 10 minutes >>
*Main> maxChain 400000

The ratio memreq/n seems to be more or less constant :
*Main> 3697648/1000
3697.648
*Main> 31560008/10000
3156.0008
*Main> 347122064/100000
3471.22064
*Main> 709303708/200000
3546.51854
*Main> 1083800124/300000
3612.66708

Thank you,

Bruno.

2008/3/31, Bulat Ziganshin <bulat.ziganshin at gmail.com>:
> Hello Bruno,
>
>
>  Monday, March 31, 2008, 7:51:43 PM, you wrote:
>
>  > I've written the following program... Which does not end in a reasonable time :(
>  > My algorithm seems ok to me but I see that memory consumption is gigantic...
>  > Is this a memory problem with Data.Map ? Or an infinite loop ? (Where ?)
>  > In a more general way, how can I troubleshoot these kind of problem ?
>
>
> first step is to reduce n and see whether program will finish and how
>  memreqs depends on value of n
>
>  > main =
>  >     let n = 1000000
>
>
>
>  --
>  Best regards,
>   Bulat                            mailto:Bulat.Ziganshin at gmail.com
>
>


More information about the Haskell-Cafe mailing list