Skip to content

Detect GHC 9.4 and use -fprof-late - #6970

Open
dpwiz wants to merge 5 commits into
commercialhaskell:masterfrom
dpwiz:prof-late
Open

dpwiz wants to merge 5 commits into
commercialhaskell:masterfrom
dpwiz:prof-late

Conversation

@dpwiz

@dpwiz dpwiz commented Oct 13, 2026

Copy link
Copy Markdown

For #6197, following https://well-typed.com/blog/2023/03/prof-late/

  • Any changes that could be relevant to users have been recorded in ChangeLog.md.
  • The documentation has been updated, if necessary
    • The change seems to "do the right thing" without bothering users with details. The profiling just works better.

@mpilgrem

Copy link
Copy Markdown
Member

@dpwiz, thanks for the contribution. Sorry for the delay, I needed to read up on the topic. Swapping -fprof-late for -fprof-auto seems sensible (and there is always -fno-prof-late, if a Stack user does not agree). I think the change in behaviour provides an opportunity for improved Stack documentation; I can add that.

A small thing, but I am not sure ghcSupportsProfLate is best placed in Stack.Constants. There are some exceptions, but that module exports mostly close to named literals. I may move it closer to the action.

Also, it seemed to me that it was rather a case of:

-- The strategy recommended by the GHC User's Guide for the
-- automatic insertion of cost centres for profiling:
recommendedProfStrategy :: Version -> String
recommendedProfStrategy ghcVersion
  | ghcVersion >= mkVersion [9, 4, 1] = "-fprof-late"
  | otherwise = "-fprof-auto"

@mpilgrem

Copy link
Copy Markdown
Member

I've rebased on the master branch.

@mpilgrem

mpilgrem commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

I think a simpler approach can be taken to Cabal's --profiling-detail=none. I've added a commit and the code comment in it explains my reasoning.

EDIT: That allows for simplification elsewhere, which I have reflected in a second commit.

@mpilgrem

Copy link
Copy Markdown
Member

I've framed the change log entry in terms of Stack catching up with the GHC User's Guide's recommendation (that is, this could be viewed as a sort of 'bug fix').

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants