[Haskell-cafe] Speedy parsing
Salvatore Insalaco
kirby81 at gmail.com
Fri Jul 20 12:21:10 EDT 2007
2007/7/20, Tillmann Rendel <rendel at rbg.informatik.tu-darmstadt.de>:
> Re, Joseph (IT) wrote:
> > At this point I'm out of ideas, so I was hoping someone could identify
> > something stupid I've done (I'm still novice of FP in general, let alone
> > for high performance) or direct me to a guide,website,paper,library, or
> > some other form of help.
I think that your problem is simply an excess of lazyness :).
foldr is too lazy: you pass huge structures to fold, that you evaluate anyway.
Try to import Data.List and use foldl' (not foldl), that is strict.
Being left fold, you probably need to rework a bit your functions (I
tried to simply flip them, but the result of the program wereflipped
too), but the time (and memory) difference is unbelievabl (foldl' is
constant in memory allocation).
Salvatore
More information about the Haskell-Cafe
mailing list