Questions about "time and space profiling for non-strict langs" paper and cost centre impl. of GHC
Ömer Sinan Ağacan
omeragacan at gmail.com
Thu May 15 14:15:22 UTC 2014
Hi all,
I'm trying to understand the paper "Time and space profiling for
non-strict, higher-order functional languages"[1] and I'm hoping that
experienced GHC devs here could help me clarifying some points. Here's
my question:
In Figure 5, I don't understand why no costs are attributed to `app2`
rule(substitution rule). It looks like to me that this is the function
application rule so `A` cost should be attributed here, but in the
paper `A` cost is attributed in `app1` rule, which if I understand
correctly shows how function part of an application is evaluated.
I know about the "lexical scoping rule" explained in 2.4 and the cost
should be attributed to the cost center in the scope of lambda
definition instead of the cost center in "application site", but
Figure 5 still doesn't make sense to me.
To me it looks like that there should be two costs attributed in
application rules. First cost is "evaluation of the function"
part(which should be attributed in `app1` rule) and second is
"substitution" part, which should be attributed in `app2` rule but
according to the paper we only have the former cost, and the latter is
free(e.g. no costs are attributed in second rule).
It would be appreciated if someone could help me clarifying this. I'm
also looking for more recent papers about GHC's profiler
implementation. I'm especially interested profiling in multi-threaded
RTS.
Lastly, it'd be appreciated if someone could explain me two Bool
fields in `StgSCC` constructor of STG syntax.
Thanks!
UPDATE: I was reading the paper one more time before sending my
question and I found one more confusing part. In 4.1 it says "Lexical
scoping will subsume all the costs of applying `and1` to its call
sites..." but in 2.4 it says "Lexical scoping: Attribute the cost to
"fun", the cost centre which lexically encloses the abstraction." so
this two definitions of same thing is actually different. To me it
looks like the definition in 4.1 is wrong,, it should be "definition
site", not "call site". What am I missing here?
[1]: http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=36FE097056F4E03CCDD38B598158292E?doi=10.1.1.43.6277&rep=rep1&type=pdf
---
Ömer Sinan Ağacan
http://osa1.net
More information about the ghc-devs
mailing list