[Haskell-cafe] Speedy parsing

Re, Joseph (IT) Joseph.Re at MorganStanley.com
Fri Jul 20 16:20:06 EDT 2007


Oh, I didn't realize how much of a difference it would make.  Thanks a
lot!

-- Joseph Re 

-----Original Message-----
From: Salvatore Insalaco [mailto:kirby81 at gmail.com] 
Sent: Friday, July 20, 2007 12:21 PM
To: Tillmann Rendel
Cc: Re, Joseph (IT); haskell-cafe at haskell.org
Subject: Re: [Haskell-cafe] Speedy parsing

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

NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.


More information about the Haskell-Cafe mailing list