我正在使用 IxSet
继续开发我的程序,我很好奇我是否做错了什么(或者可以优化)。目前它消耗的内存比我想象的要多。
程序在这里:https://bitbucket.org/k_bx/duplicates 分析结果在这里:https://gist.github.com/4602235
附注:请有人添加“ixset”标签,因为我无法创建标签。
更新:
使用 -h 进行内存分析:http://img-fotki.yandex.ru/get/6442/72443267.2/0_9d04d_4be1cd9f_orig
更新2:
同一 -h 文件的整洁内存分析 View :http://heap.ezyang.com/view/c1781ec5e53b00d30a9f8cd02f0b8a5e777674c9#form
最佳答案
您只是使用普通堆分析,它不一定捕获数据结构的使用情况。正如您所指出的,它按代码中的函数分解堆。您可以通过几个选项来通过探查器来获取您想要的内容(来自 ghc 指南: http://www.haskell.org/ghc/docs/latest/html/users_guide/prof-heap.html#rts-options-heap-prof )
-hc (can be shortened to -h). Breaks down the graph by the cost-centre stack which produced the data.
-hm Break down the live heap by the module containing the code which produced the data.
-hd Breaks down the graph by closure description. For actual data, the description is just the constructor name, for other closures it is a compiler-generated string identifying the closure.
-hy Breaks down the graph by type. For closures which have function type or unknown/polymorphic type, the string will represent an approximation to the actual type.
-hr Break down the graph by retainer set.
-hb Break down the graph by biography. Biographical profiling is described in more detail below
hm、hd 和 hr 可能对您最有用。经过一番思考,您还可以使用 hb 获取有关严格性属性的一些信息。
关于haskell - 如何分析 IxSet?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14472958/