Re: Haskell-beginners problem with memory consuption

2003-10-02 Thread Ketil Malde
Petter Egesund [EMAIL PROTECTED] writes: I load my file in one chunk, and does a lot of substitutes on the string - this is quick eating all my memory and the computers start to get really slow. Keep in mind that Strings are lists of characters. I think (somebody correct me if I'm wrong) GHC

Re: SV: Haskell-beginners problem with memory consuption

2003-10-02 Thread Ketil Malde
Petter Egesund [EMAIL PROTECTED] writes: fun :: String - String look for pat1 in string - if found subst with sub1 look for pat2 in string - if found subst with sub2 look for pat3 in string - if found subst with sub3 recurse until no pattern is found I would structure

RE: Haskell-beginners problem with memory consuption

2003-10-02 Thread Simon Marlow
Keep in mind that Strings are lists of characters. I think (somebody correct me if I'm wrong) GHC will store a character inside a cons cell, but that still leaves 8 bytes per character. Worst case it will store the 8-byte cons cell pointing to a 32-bit char value, 12 bytes per character.

Re: Haskell-beginners problem with memory consuption

2003-10-01 Thread Wolfgang Jeltsch
Am Mittwoch, 1. Oktober 2003, 15:18 schrieb Petter Egesund: [...] The problem is of course that the string is copied each time I do a substitute, and I wonder if a more experienced haskeller has a better solution to my problem. It doesn't have to be a problem that the string is copied each

SV: Haskell-beginners problem with memory consuption

2003-10-01 Thread Petter Egesund
recurse until no pattern is found Cheers PE -Opprinnelig melding- Fra: Wolfgang Jeltsch [mailto:[EMAIL PROTECTED] Sendt: 1. oktober 2003 15:36 Til: The Haskell Cafe Emne: Re: Haskell-beginners problem with memory consuption Am Mittwoch, 1. Oktober 2003, 15:18 schrieb Petter Egesund