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

Using Strict and StrictData by default #454

Closed
wants to merge 5 commits into from

Conversation

kazu-yamamoto
Copy link
Collaborator

To avoid unexpected behavior, let's use Strict and StrictData for version 4. This PR include:

  • Introducing the lazy binding for sizeOf and alignment where undefined is typically passed.
  • Removing undefined as much as possible.

Discussion:

  • Due to inlining, sizeOfSockAddr returns 0. I don't know why. See 6bff610 for my workaround. Without this commit, the test fails.
  • Three undefineds still remain. For instance, siz = sizeOf (undefined :: a). We need to check if these do not harm.

@kazu-yamamoto
Copy link
Collaborator Author

Cc: @vdukhovni

@kazu-yamamoto
Copy link
Collaborator Author

Relating to #412

@vdukhovni
Copy link

I like StrictData, but I am very much not a fan of Strict, especially as a default. Enable it in some specific modules where you can demonstrate meaningful performance improvements, but otherwise I would not like to see it used. I think it is over-rated, and may as often make things slower, or change semantics.

@kazu-yamamoto
Copy link
Collaborator Author

I know a person who like Strict but not StrictData. :-)

My motivation is to make it easier to debug memory (or space) leak. Without these pragmas, I need to suspect everything. For performance, we have a profiling. If performance gets poor, we can try adding lazy patterns with profiling. But for memory leak, we don't have good tools at all.

@vdukhovni
Copy link

vdukhovni commented May 15, 2020

Is there a space leak in the Network library that motivates these changes? You can find space leaks with cost-centre annotations and tools that report memory use by cost-centre. This is not that difficult.

Many space leaks are taken care of via StrictData. I don't think I can support a default Strict pragma, but the changes to avoid undefined where it is reasonably natural to do so are fine regardless.

@kazu-yamamoto
Copy link
Collaborator Author

I don't know that network is actually leaking. But I know that all libraries can leak with lazy evaluation.

Even forever leaked in the past: https://gitlab.haskell.org/ghc/ghc/issues/12804. I don't want to spend my time for such things.

I realized that I can split this PR into three:

  1. removing undefined as much as possible
  2. introducing StrictData
  3. introducing Strict

I guess that @vdukhovni agrees with 1) and 2).

What do other guys think? Please speak up.

This was referenced May 19, 2020
@kazu-yamamoto
Copy link
Collaborator Author

I'm closing this in favor of #457.

@kazu-yamamoto kazu-yamamoto deleted the strict branch June 5, 2023 01:05
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