Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various strictness improvements #3413

Merged
merged 4 commits into from
Dec 21, 2022
Merged

Various strictness improvements #3413

merged 4 commits into from
Dec 21, 2022

Conversation

wz1000
Copy link
Collaborator

@wz1000 wz1000 commented Dec 20, 2022

Various strictness annotations that marginally improve heap usage.

@wz1000 wz1000 force-pushed the wip/mem-strictness branch from 3e20fc3 to cb99e7d Compare December 20, 2022 12:50
@@ -1455,18 +1455,6 @@ loadInterface session ms linkableNeeded RecompilationInfo{..} = do

case (mb_checked_iface, recomp_iface_reqd) of
(Just iface, UpToDate) -> do
-- If we have an old value, just return it
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out that reusing the same ModDetails as we had last time can keep the previous HscEnv and corresponding HomePackageTable data structures alive. Solution is to delete this code and always regenerate the ModDetails from the interface.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!! Very important to do this (and cheap)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a cautionary note? should we somehow get rid of old_value entirely? or is it okay to use it so long as we don't retain anything from it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need it for the old ModIface (which is safe to use).

@@ -45,7 +46,7 @@ data GetInstanceBindTypeSigs = GetInstanceBindTypeSigs

data InstanceBindTypeSig = InstanceBindTypeSig
{ bindName :: Name
, bindRendered :: T.Text
, bindRendered :: !T.Text
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason this needs to be strict while the other values arent?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It showed up in a profile, the others are likely to already be evaluated I think.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then a comment would be nice.
Also, would a guideline be wise that generally says everything in records needs a bang, and only in certain exceptional cases you don't need them?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it seems clearer to bang everything in situations like this? Unsure.

Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wz1000 wz1000 added the merge me Label to trigger pull request merge label Dec 21, 2022
@wz1000 wz1000 added merge me Label to trigger pull request merge and removed merge me Label to trigger pull request merge labels Dec 21, 2022
@mergify mergify bot merged commit 02e2de5 into master Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Label to trigger pull request merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants