
26 Jan
2017
26 Jan
'17
6:42 a.m.
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.