Very good post mortem!
Thanks for writing it up.
A small note: let statements only correspond to heap allocations in Core — that is, if you see a let
in Core it essentially implies heap allocation, but that is not true for source level lets!
This is kind of implicit in your sentence’s context, but I would make it explicit
I thought lets were only really allocations in STG.
That’s right, in STG let
always implies allocation. But a let in simplified Core almost always ends up as an allocation as well I believe.
This could be an interesting thing to easily check: since let
in STG means allocation, simply count how many lets you have in STG and how many lets you have in Core, for any given program (using -ddump-simpl
for Core and -ddump-stg-final
for STG).
Thanks! Updated the post