Hi

>        *Main> uni_bill laemmel
>        {CompanyDatatypes.Employee}
>        {CompanyDatatypes.Salary}
>        8000
>        *Main> uni_bill laemmel
>        {CompanyDatatypes.Employee}
>        {CompanyDatatypes.Salary}
>        8000
>        *Main> (uni_bill laemmel,uni_bill laemmel)
>        ({CompanyDatatypes.Employee}
>        {CompanyDatatypes.Salary}
>        8000,8000)
>
>  I might still be on the wrong track, explanation-wise, but if I apply this
> to the SYB traversal, I get the expected speedup.
>  So I'll give my head some rest from this sometimes-it-works
>  sometimes-it-doesn't problem!-)

I tried this, with the same results. I was wondering if GHCi just
forced dumped all CAF's stored in this way between expression runs?

>  Btw, the fast SYB version now only creates one type map, for the top type
> Company - why does Uniplate create two?

Uniplate does one traversal from Company -> Salary, using the Biplate
mechanism. Once it has reached a salary, it then does a Uniplate
traversal from Salary -> Salary. Hence it has to do Company/Salary and
Salary/Salary. I do wonder if the Salary/Salary traversal is
under-optimised by using a Map when only Float is a child.

>  It may be that there are two parts to the caf-in-instance trick,
>  making cafs and passing cafs down the traversal, but anyway
>  Uniplate does manage to get by with only two type maps.
>
>  Something else, then - sorry to hear that.

It seems an interesting issue, whatever it is. It also seems to bite
as data structures get very large, which makes it less of a pressing
issue at least in my particular uses. Once I've got some more data I'm
sure I'll track it down.

Thanks

Neil

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to