New core profiling mode
ben at well-typed.com
Wed Nov 15 16:59:52 UTC 2017
Douglas Wilson <douglas.wilson at gmail.com> writes:
> Hi ghc-devs,
> I've been working on a new mode of adding cost-centres to programs and I'd
> like to ask some questions and solicit some feedback. The code is here
> it works, provided one enables -fprof-core on all modules.
> I've recently been trying to pick some low hanging fruit from ghc
> performance. A common frustration was in the difference between profiled and
> non-profiled builds. Often I thought had I found a problem in the profiled
> build, only to find it was optimized away in the non-profiled build. Several
> times an issue was tail-calls not happening in profiled builds.
> To solve this problem I've been working on a new way of inserting
> cost-centres: adding them to core after simplification (currently at
> the end of corePrepPgm) rather than adding them to HsSyn before
> simplification. This makes it harder to map cost-centres into source
> code (You have to -ddump-prep currently), but in
> exchange you are profiling the same core program as the non-profilied build.
Sounds quite reasonable to me.
> I intend to investigate whether I can use SourceNotes to create
> SrcSpans for the generated cost-centres to somewhat alleviate the need
> to inspect dumped core.
Yes, I think this would be a great idea. I have also wondered in the
past whether it would be worthwhile (optionally?) adding a CSS-like name
SourceNote (e.g. in addition to a SrcSpan, include the name of the
containing binding; for instance "insert.go"). This would make it a bit
easier to understand a backtrace at-a-glance.
> Do you have any examples of programs for which existing profiling tools are
> inadequate due to how cost-centres affect simplification? There is an
> example in #12893 but something self-contained would be great!
I'm afraid I don't know of any off-hand.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 487 bytes
Desc: not available
More information about the ghc-devs