On Sat, Jul 19, 2008 at 9:52 PM, Chaddaï Fouché <
chaddai.fouche@gmail.com> wrote:
2008/7/19 Krzysztof Skrzętnicki <gtener@gmail.com>:
> Hi all
>
> 1) Profiling shows that very simple functions are source of great memory and
> time consumption. However, if I turn them off and simply print their input
> arguments instead, the overall time and memory consumption doesn't change.
> But now another function is acting badly. My guess: somehow the cost of
> Parsec code is shifted into whatever function is using it's output. Let's
> see:
Are you using Parsec to parse the whole file ? Then your problem is
there : Parsec needs to read and process the whole file before it can
give us any output since it thinks it could have to give us an error
instead and it can't be sure of that before he has read the whole
thing...
In your case, your problem is such that you would prefer to treat the
file as a stream, isn't it ?
There are some parser library that can give output lazily (look at
polyparse flavour), another option would be to only use Parsec where
you need it and just read and print the ordinary text for example.
--
Jedaï