Douglas Wilson <[email protected]> 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
> [fn:1],
> it works, provided one enables -fprof-core on all modules.
>
> I've recently been trying to pick some low hanging fruit from ghc
> compilation
> 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.

Cheers,

- Ben

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ghc-devs mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Reply via email to