[Haskell-cafe] efficient combination of foldl' and foldr ->
foldl'r
Joachim Breitner
mail at joachim-breitner.de
Fri Dec 5 17:54:56 EST 2008
Hi,
Am Freitag, den 05.12.2008, 23:43 +0100 schrieb Henning Thielemann:
> > ryani$ ghci foldlr.hs
> > [...]
> > Prelude FoldLR> :set +s
> > Prelude FoldLR> test
> > (1000000,'a')
> > (0.39 secs, 70852332 bytes)
> > Prelude FoldLR> testNaive
> > (1000000,'a')
> > (0.42 secs, 105383824 bytes)
>
> There is still no clear advantage of foldl'r compared to foldl'rNaive, is
> it?
Maybe not directly speed-wise, but the memory consumption is reduced by
30% (probably due to laziness, and unless I misreading ghci’s output)
Greetings,
Joachim
--
Joachim "nomeata" Breitner
mail: mail at joachim-breitner.de | ICQ# 74513189 | GPG-Key: 4743206C
JID: nomeata at joachim-breitner.de | http://www.joachim-breitner.de/
Debian Developer: nomeata at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20081205/5beafdbc/attachment.bin
More information about the Haskell-Cafe
mailing list