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
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
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.
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
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