[Haskell-cafe] ansi2html - one program, several issues

Krzysztof Skrzętnicki gtener at gmail.com
Sat Jul 19 17:55:45 EDT 2008


On Sat, Jul 19, 2008 at 11:35 PM, Chaddaï Fouché <chaddai.fouche at gmail.com>
wrote:

> 2008/7/19 Krzysztof Skrzętnicki <gtener at gmail.com>:
> > I forgot to mention that the memory consumption is several times higher
> than
> > file size. On 8,3 Mb file:
> >> 532 MB total memory in use (4 MB lost due to fragmentation).
> >
> > Having that 8 Mb in memory is not the problem. 532 Mb is another story.
> In
> > general, the program consumes roughly 64 times more memory than file size
> > and it scales linearly.
>
> You should be using ByteString, though this problem would be
> alleviated if you were consuming the file as a stream.
>
>
Since ANSI color codes doesn't contain characters like newline or space, I
have simply split input file into such lines. Now the whole program behaves
much better: GC time is below 10% and memory consumption dropped to 74 Mb
per thread. It's still a lot of memory though and it certainly holds much
more than one line of text.

Best regards
Christopher Skrzętnicki
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080719/52dbcdb4/attachment.htm


More information about the Haskell-Cafe mailing list