Profiling GHC generated functions with `deriving` keyword

I am trying to optimize a Haskell program. In the profiler output, I see that a lot of time is spent inside compare and == functions. But, the GHC profiler doesn't tell me anything more than the module name of those functions. I guess these are the GHC generated functions using deriving Eq and Ord . I wonder if there is an easy way to pinpoint where the actual problem is. For instance, using {-# SCC "more-specific-name" #-} for those functions.


Use -ddump-deriv to dump out the code for the actual derived instances GHC generates, then grab the code and put it under your own explicitly defined functions. Then explicitly derive the instances and point them at your functions.

链接地址: http://www.djcxy.com/p/43214.html

上一篇: GHC可以在严格的数据字段上枚举枚举吗?

下一篇: 使用`derivation`关键字分析GHC生成的函数