
Hi Dennis, On 06/07/17 17:53, Dennis Raddle wrote:
I have a program which does backtracking search in a recursive function. I followed the chapter in "Real World Haskell" to parallelize it. [snip] There's no effect from the R.W.H. ideas. Can I get some suggestions as to why?
You can get timing and other useful diagnostics by compiling with -rtsopts and running with +RTS -s, no need to measure CPU time in your own program.
force :: [a] -> () force xs = go xs `pseq` () where go (_:xs) = go xs go [] = 1
This force doesn't do enough, it just walks the spine. Try this, which forces the elements as well as the shape: force :: [a] -> () force xs = go xs `pseq` () where go (x:xs) = x `pseq` go xs go [] = 1 Thanks, Claude -- https://mathr.co.uk