profiling a constructor?

Ben Gamari ben at
Sat May 23 13:50:20 UTC 2020

On May 23, 2020 9:32:32 AM EDT, Andreas Klebinger <klebinger.andreas at> wrote:
>> Surely, the RTS must be able to count the number of times a
>constructor is used.
>It can't. For one there are different kinds of "uses" for constructors.

This is a fair point. I had assumed that Richard was debugging a residency issue but i suppose that was an ungrounded assumption on my part. 

>* Allocations - They might be dead by the time we gc the nursery, so
>RTS never get's to see them.

Indeed I thought that the ticky-ticky profiler could do precisely this but it seems I was mistaken; it can only report thunks. Indeed it doesn't seem like it would be hard to introduce this.

>* Accessing the Constructor? That's even harder to track.

Indeed, this is not possible as written. However, the LDV profiler allows a slightly weaker version on this (reporting whether the closure as been read at all).

Allowing full tracking of closure reads this would incur a significant overhead.

More information about the ghc-devs mailing list