LateCC profiling: Future improvements
While the profiling pass has not yet been released there are some obvious incremental improvements that could be made to it:
-
Don't put cost centres on boring constructor applications. E.g. things like
lvl = <scc> Just x
. The code generator I think already just ignores such cost centres so all this does is create churn and it seems easy to cheap. Most prominently this happens with typeable bindings. This would primarily be a compile time improvement. -
Implement heuristics about which bindings to annotate. There are a number of possible heuristics I can think of. Size of RHS, exported or not, externally visible or not, recursive or not. These could be made flags to allow more control.
For example it's likely overkill the compile a users whole haskell stack including all libraries with cost centres on all top level binds. I imagine for libraries used by a user only putting them on exported/externally visible bindings would be better. -
Annotate local let binders, in particular local recursive let binders. It's not unusual to have a local recursive let binding which does the majority of the work. Having such bindings pop up more explicitly in the profile would be beneficial.
-
Better names for things. The worst offender are currently all the "lvl" bindings float out generates. LateCC profiles as well as core output would be easier to understand if these included the name of their origin in same fashion. If
expr
is floated out offoo
just naming itfoo_lvl
insteadlvl
would already be a big improvement. But I'm not sure how easy or expensive such a change would be.
None of these are high priority. But it's good to record these ideas anyway.