Better indication of indirections in output graphs #1

Open
thoughtpolice opened this Issue Dec 2, 2011 · 0 comments

1 participant

@thoughtpolice

Johan Tibell (@tibbe) had some great slides about Haskell performance for Stanford's "CS240h: Functional Systems in Haskell" course, located here: http://blog.johantibell.com/2011/11/slides-from-my-guest-lecture-at.html

It'd be nice if Vacuum could more clearly indicate indirections in the output graph, so you can see how many words of memory a particular value uses. Compare slide 13 of Johan's talk, the memory layout of the list [1,2], with the vacuum output of the same expression:

https://github.com/thoughtpolice/vacuum/raw/master/gallery/list.png
http://johantibell.com/files/stanford-2011/performance.html#%2813%29

It's somewhat close, but from this you cannot tell how much memory is needed for the expression. In Johan's example, it's clear: all indirections accounted for, the expression requires 11 words of memory.

Effectively every node in the output graph above, as an example, needs to indicate that the node itself takes 1 word of memory, and every edge connected to it is another word as well. The S# constructors (GHC infers the literals are of type Integer) on the leafs also take 2 words - one for the constructor, one for the value. With this in mind, it's easy to count from the Vacuum output there's 11 words needed, but this gets much trickier and more burdensome when you're dealing with very large graphs (say, of HashMap or IntMap)

@thoughtpolice thoughtpolice was assigned Dec 2, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment