[Haskell-cafe] fast Eucl. dist. - Haskell vs C

Claus Reinke claus.reinke at talk21.com
Mon May 18 14:54:24 EDT 2009


>> As I said, I don't get the fusion if I just add the function above to the 
>> original Dist.hs, export it and compile the module with '-c -O2 
>> -ddump-simpl':
> 
> I can't reproduce this.

Interesting. I'm using ghc 6.11.20090320 (windows), uvector-0.1.0.3. 
I attach the modified Dist.hs and its simpl output, created via:

    ghc -c Dist.hs -O2 -ddump-tc -ddump-simpl-stats -ddump-simpl > Dist.dumps

Perhaps others can confirm the effect? Note that the 'dist_fast' in the 
same module does get fused, so it is not likely an options issue. I still 
suspect that the inlining of the 'Dist.zipWith' wrapper in the 'dist_fast_inlined'
'__inline_me' has some significance - it is odd to see inlined code in an
'__inline_me' and the fusion rule won't trigger on 'Dist.sumU . Dist.$wzipWithU',
right?
 
> Does the complete program fragment I posted earlier yield the desired
> result?

Yes. Note that the original poster also reported slowdown from
use of 'dist_fast_inlined'.

Claus

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Dist.dumps
Type: application/octet-stream
Size: 17732 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090518/ddf12018/Dist.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Dist.hs
Type: application/octet-stream
Size: 1986 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090518/ddf12018/Dist-0001.obj


More information about the Haskell-Cafe mailing list