Thanks for pointing out this (Knuth's) nice test case.
I should use this as an exam question ...
Allocation and run-time can be reduced
by replacing return (x3' + x4')
with let x = (x3' + x4') in x `seq` return x
And, modifySTRef' *does* help.
I *do* notice a regression
(for the seq-ed and primed version)
ghc-8.0.2 : 2.6 GB alloc, 2.3 sec
ghc-6.10.4: 2.0 GB alloc, 1.7 sec
(measured on X5365 @ 3.00GHz )
Numbers are for total allocation,
residency is small (it runs with +RTS -H10k -A10k
but then the number of GCs goes up)
- J.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell- cafe
Only members subscribed via the mailman list are allowed to post.