[Haskell-cafe] idea for avoiding temporaries

Bulat Ziganshin bulat.ziganshin at gmail.com
Sun Mar 11 17:50:51 EDT 2007

Hello Claus,

Sunday, March 11, 2007, 10:03:59 PM, you wrote:

> both the array and strict list versions avoid some intermediate structures; for the
> arbitrarily invented, relatively small inputs i've tried, strict lists are the clear winner,
> thanks to lower memory traffic, but i'd like some feedback from the experts:

> -are there any obvious inefficiencies in the array code?

obviously, arrays version should create no temporary cells. the
problems was mainly due to 2 factors:

1) readArray m (i,j)
2) 'op' in 'l' which was passed as real closure and was not inlined
due to weakness of ghc optimizer

also, we should help strictness analyzer by marking all the variables
used in tight loops as strict. after that is done, we got 1000 times
less temporary data allocated and 5x faster execution. now it's a bit
faster than strict lists

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CG.hs
Type: application/octet-stream
Size: 6433 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070312/b159d726/CG-0001.obj

More information about the Haskell-Cafe mailing list