[Haskell-cafe] Peformance digression when using "proc" notation for arrows

Brandon Allbery allbery.b at gmail.com
Sun Jul 23 22:43:38 UTC 2017


On Sun, Jul 23, 2017 at 6:26 PM, Artem <p0nk at ya.ru> wrote:

>
> sumArr = scan (\acc x -> let !newAcc = acc + x in newAcc) 0
> sumArr' = proc v -> do sumArr -< v
>
> testData :: [Int]
> testData = [1..1000000]
>
> main = print $ L.last $ evalList sumArr' testData
>
> Running time for main with sumArr (i.e. no proc notation) is 0.087 sec,
> while for sumArr' it is 3.2 seconds (and around 300mb memory usage),
> although sumArr' is just sumArr called within a proc block.
>

Absent other information (like the core from each) I would be tempted to
think that the problem is some stream fusion RULES either did not fire or
degraded into a pessimization.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170723/d657f3b2/attachment.html>


More information about the Haskell-Cafe mailing list