A way to profile an IxSet?
I keep developing my program with help IxSet
and I am curious if I am doing something wrong (or it could be optimized). It is currently consuming too much memory than it seems to me.
The program is here: https://bitbucket.org/k_bx/duplicates The profiling result is here: https://gist.github.com/4602235
ps: please someone add the "ixset" tag as I cannot create it.
UPDATE:
Memory profiling with -h: http://img-fotki.yandex.ru/get/6442/72443267.2/0_9d04d_4be1cd9f_orig
UPDATE 2:
Simple view of memory profiles for the same -h file: http://heap.ezyang.com/view/c1781ec5e53b00d30a9f8cd02f0b8a5e777674c9#form
source to share
You're just using vanilla heap profiling, which doesn't necessarily grab the use of the data structure. As you noticed, it breaks up a bunch of functions from your code. There are several options you can pass to the profiler to get what you want (from the ghc manual: http://www.haskell.org/ghc/docs/latest/html/users_guide/prof-heap.html#rts- options-heap-prof )
-hc (can be shortened to -h). Splits a graph using the cost center stack that was reporting the data.
-hm Split the live heap with a module containing the code that produced the data.
-hd Splits the graph according to the description of the closure. For actual data, the description is just the name of the constructor; for other closures, it is a compiler-generated string that identifies the closure.
-hy Splits the graph by type. For closures that are of function type or unknown / polymorphic type, the string will be an approximation to the actual type.
-hr Split chart by fixer set.
-hb Break the chart by biography. Biographical profiling is described in more detail below.
hm, hd and hr will probably be the most useful for you. You can also, with a little guess, get some information about the strictness properties using hb.
source to share