[Haskell-cafe] Re: Over-allocation
dons at galois.com
Wed Nov 21 12:35:21 EST 2007
> Ketil Malde <ketil+haskell <at> ii.uib.no> writes:
> > Then you get the memory behavior you ask for. Unevaluated strings are
> > extremely expensive, something like 12 bytes per char on 32 bit, twice
> > that on 64 bits, and then you need GC overhead, etc. ByteStrings are
> > much better, but you then probably need to implement your own XML
> > parsing.
> My lazy chunks have type ByteString -> Object. Only internally they use
> ByteString.unpack to get the list of Word8s to parse them.
> My parser is totally my own so I can do anything I wish. Except it is hard for
> me to image a parser working on something else than [Word8]. How do I do this?
ByteStrings have all the same operations as lists though, so you can
index, compare and take substrings, with the benefit that he underlying
string will be shared, not copied. And only use 1 byte per element.
> So how do I get rid of those (:) and W8# that are allocated everywhere on my
> Thanks for the suggestion for -hd, really useful option!
More information about the Haskell-Cafe