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 language extension #412

Closed
kazu-yamamoto opened this issue Jun 13, 2019 · 4 comments
Closed

Using strict language extension #412

kazu-yamamoto opened this issue Jun 13, 2019 · 4 comments
Assignees

Comments

@kazu-yamamoto
Copy link
Collaborator

In my opinion, network programming in Haskell should use strict evaluation except atomicModifiyIORef', to avoid space leak. Strict and StrictData language extension are introduced in GHC 8.0 and it's days of GHC 8.6. So, it's good time to introduce them to network.

For this purpose, all undefined should be removed. It's very easy. But during this work, I experienced that undefined are evaluated even if they are removed from the source code. The reason is here: https://gitlab.haskell.org/ghc/ghc/issues/16810

When such inlinable functions are fixed in GHC 8.8, I would like to add the following to network.cabal:

  if impl(ghc >= 8.8)
      Default-Extensions:  Strict StrictData
@eborden
Copy link
Collaborator

eborden commented Jun 13, 2019

We should probably formulate some realistic benchmarks before introducing a change of this nature.

@kazu-yamamoto
Copy link
Collaborator Author

SPJ helped me to understand what's going on. This is not a bug of base. We can use these extensions for all versions of GHC 8 now.

https://github.com/kazu-yamamoto/network/tree/strict

@eborden eborden added this to the 2019 Q4 Release milestone Jun 20, 2019
@kazu-yamamoto
Copy link
Collaborator Author

warp, warp-tls, auto-update, wai-app-file-cgi and mighttpd2 have been released with Strict and StrictData enabled by default.

@kazu-yamamoto
Copy link
Collaborator Author

I should explain this. The purpose of this PR is to let us convinced that space leaks are not due to lazy evaluation when they occurs. This PR might not improve heap profiling but would save our souls very much. I'm very tired from finding sources of space leaks due to lazy evaluation for last 10 years.

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

No branches or pull requests

2 participants