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

High cpu and memory usage with lens typed holes #2731

Open
farmerzhang1 opened this issue Feb 21, 2022 · 4 comments
Open

High cpu and memory usage with lens typed holes #2731

farmerzhang1 opened this issue Feb 21, 2022 · 4 comments
Labels
type: enhancement New feature or request

Comments

@farmerzhang1
Copy link

Your environment

WSL2 Ubuntu 20.04

vscode-haskell

my cabal file

cabal-version:      2.4
name:               hls-lens-hole
version:            0.1.0.0

executable hls-lens-hole
    main-is:          Main.hs
    build-depends:    base ^>=4.14.3.0, lens
    hs-source-dirs:   app
    default-language: Haskell2010

ghc version

The Glorious Glasgow Haskell Compilation System, version 8.10.7

cabal

cabal-install version 3.6.2.0
compiled using version 3.6.2.0 of the Cabal library

HLS version (vscode-haskell installs the latest version automatically)

ls ~/.vscode-server/data/User/globalStorage/haskell.haskell/
haskell-language-server-wrapper-1.6.1.0-linux
haskell-language-server-1.6.1.0-linux-8.10.7

Steps to reproduce

open the following code in vscode

pair :: IndexedFold Bool (a, a) a
pair p (a, b) = _ -- (,) <$> indexed p False a <*> indexed p True b

hover over the hole, then inspect other variables (e.g. a or b).

Expected behaviour

don't crash

Actual behaviour

HLS may be slow with some holes (lens is big) but it shouldn't crash. HLS tries to load but not showing the result (cpu and memory usage are super high), after a few tries it crashes.

@farmerzhang1 farmerzhang1 added status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels Feb 21, 2022
@pepeiborra
Copy link
Collaborator

I suspect that it is GHC that is being slow and using lots of memory here. If that's the case, GHC 9.2 and newer will perform much better. Could you try and confirm?

@farmerzhang1
Copy link
Author

GHC 9.2.1 does perform much better. But I see other strange things, for example, the type of term a should be a but it shows a really weird type a_a1vyB instead

@michaelpj
Copy link
Collaborator

(Related to the type variable issue: #2716)

@michaelpj
Copy link
Collaborator

It might also be good to revive #1914, hole-fitting will likely always be quite expensive.

@kokobd kokobd added type: enhancement New feature or request and removed type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. status: needs triage labels Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants