haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.39k stars 211 forks source link

Hover causes far too much memory #1156

Closed mpickering closed 5 years ago

mpickering commented 5 years ago

The way that the types are collected from the AST by using syb uses a lot of memory. This was already identified when haddock started using HIE files for its hyperlinker. The solution is to make the traversal smarter to only recover types at the leaves rather than for all subexpressions.

This issues makes HIE unusable with GHC (or any big project) as the process of traversing a single module is too expensive.

cc @wz1000

mpickering commented 5 years ago

This change makes a big difference. https://github.com/mpickering/ghc-mod/commit/1544779ac040ca30d5b3e0c5b9156e2007a51c4d

If someone wants to finish this off then they need to reimplement collectSpanTypes in Haskell.Ide.Engine.ArtifactMap in order to build the type map directly whilst performing the query rather than building an intermediate list and copy these changes into ArtifactMap so the type map generation doesn't depend on ghc-mod at all.

Another reference is - https://gitlab.haskell.org/ghc/ghc/blob/fef4a8dd65428cbcdc4aa58f0444eae9f5cc63ed/compiler/hieFile/HieAst.hs

fendor commented 5 years ago

I can take a look at it, this week!

fendor commented 5 years ago

Problem has been adressed and merged into #1126.