[英]Profiling GHC generated functions with `deriving` keyword
I am trying to optimize a Haskell program. 我正在尝试优化Haskell程序。 In the profiler output, I see that a lot of time is spent inside compare
and ==
functions. 在事件探查器输出中,我发现在compare
和==
函数内部花费了大量时间。 But, the GHC profiler doesn't tell me anything more than the module name of those functions. 但是,GHC分析器只告诉我这些函数的模块名称。 I guess these are the GHC generated functions using deriving Eq
and Ord
. 我想这些是使用Eq
和Ord
推导的GHC生成的函数。 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. 例如,对这些功能使用{-# SCC "more-specific-name" #-}
。
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. 使用-ddump-deriv
转储GHC生成的实际派生实例的代码,然后获取代码并将其放在您自己的显式定义的函数下。 Then explicitly derive the instances and point them at your functions. 然后显式派生实例并将其指向您的功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.