[Haskell-cafe] deepSeq vs rnf
Bulat Ziganshin
bulat.ziganshin at gmail.com
Mon Oct 23 03:09:11 EDT 2006
Hello Cale,
Monday, October 23, 2006, 7:19:14 AM, you wrote:
> Speaking of boilerplate and the scrapping thereof, Data.Generics could
> theoretically also be used to write a relatively generic rnf/deepSeq,
> but in my attempts, it seems to be much much slower than using a
> specific normal form class. Here's my code from quite a while back. As
> I recall, it's semantically correct, but ran about an order of
> magnitude slower. There might be a much better way to do it, I don't
> really know Data.Generics all that well.
by no means it's surprising - syb library works slower than
hand-written or compile-time generated code because it implements
_run-time_ polymorphism - data types are tested at run-time and then
coerced to their actual types. there is also syb4 approach by Oleg
where type classes used for polymorphism - it should have average
speed, in theory
--
Best regards,
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Libraries
mailing list