-
Notifications
You must be signed in to change notification settings - Fork 97
Cache a ghc session per file of interest #630
Conversation
caf7344
to
5b5cf6d
Compare
Unfortunately github doesn't allow SVG attachments in PRs, so I have uploaded the benchmarks here: https://github.com/pepeiborra/ghcide/tree/module-ghc-session-benchmarks/bench-hist/module-ghc-session |
We set up a GHC session (load deps, setup finder cache) every time we want to: - typecheck a module - get the span infos This is very expensive, and can be cached.
14c3e0c
to
96901df
Compare
This allows to bypass work when a module imports & pragmas haven't changed, e.g. GetDependencies, GetDependencyInformation, GetLocatedImports, etc.
Added early cut-off for the This results in further perf improvements for hover after edit and for edit. Rendered in the charts below as "modsummary-ghc-session" |
Not sure where that came from
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice thank you! A few small comments.
871d2d1
to
92d127f
Compare
Windows 10 build is failing as usual, please retry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thank you!
* Cache a GHC session per module We set up a GHC session (load deps, setup finder cache) every time we want to: - typecheck a module - get the span infos This is very expensive, and can be cached. * cache the Ghc session for files of interest only * hlint * fix 8.4 build * Early cut-off for ModSummary rule This allows to bypass work when a module imports & pragmas haven't changed, e.g. GetDependencies, GetDependencyInformation, GetLocatedImports, etc. * remove extraneous reverse Not sure where that came from * review feedback
The regression was introduced in haskell#630 - it introduced `GhcSessionDeps` with the idea of reusing the GHC session built for typechecking for computing the SpanInfo, instead of rebuilding it from scratch. But I forgot to actually reuse it, or maybe the change got lost during the merge.
The regression was introduced in haskell#630 - it introduced `GhcSessionDeps` with the idea of reusing the GHC session built for typechecking for computing the SpanInfo, instead of rebuilding it from scratch. But I forgot to actually reuse it, or maybe the change got lost during the merge.
The regression was introduced in haskell#630. I added `GhcSessionDeps` with the idea of reusing the typecheck GHC session for computing the SpanInfo, instead of rebuilding it from scratch. But I forgot to actually reuse it, or maybe the change got lost during the merge.
* Fix regression in SpanInfo haddocks for local modules The regression was introduced in #630. I added `GhcSessionDeps` with the idea of reusing the typecheck GHC session for computing the SpanInfo, instead of rebuilding it from scratch. But I forgot to actually reuse it, or maybe the change got lost during the merge. * Add test
* Cache a GHC session per module We set up a GHC session (load deps, setup finder cache) every time we want to: - typecheck a module - get the span infos This is very expensive, and can be cached. * cache the Ghc session for files of interest only * hlint * fix 8.4 build * Early cut-off for ModSummary rule This allows to bypass work when a module imports & pragmas haven't changed, e.g. GetDependencies, GetDependencyInformation, GetLocatedImports, etc. * remove extraneous reverse Not sure where that came from * review feedback
* Fix regression in SpanInfo haddocks for local modules The regression was introduced in haskell/ghcide#630. I added `GhcSessionDeps` with the idea of reusing the typecheck GHC session for computing the SpanInfo, instead of rebuilding it from scratch. But I forgot to actually reuse it, or maybe the change got lost during the merge. * Add test
* Cache a GHC session per module We set up a GHC session (load deps, setup finder cache) every time we want to: - typecheck a module - get the span infos This is very expensive, and can be cached. * cache the Ghc session for files of interest only * hlint * fix 8.4 build * Early cut-off for ModSummary rule This allows to bypass work when a module imports & pragmas haven't changed, e.g. GetDependencies, GetDependencyInformation, GetLocatedImports, etc. * remove extraneous reverse Not sure where that came from * review feedback
* Fix regression in SpanInfo haddocks for local modules The regression was introduced in haskell/ghcide#630. I added `GhcSessionDeps` with the idea of reusing the typecheck GHC session for computing the SpanInfo, instead of rebuilding it from scratch. But I forgot to actually reuse it, or maybe the change got lost during the merge. * Add test
* Cache a GHC session per module We set up a GHC session (load deps, setup finder cache) every time we want to: - typecheck a module - get the span infos This is very expensive, and can be cached. * cache the Ghc session for files of interest only * hlint * fix 8.4 build * Early cut-off for ModSummary rule This allows to bypass work when a module imports & pragmas haven't changed, e.g. GetDependencies, GetDependencyInformation, GetLocatedImports, etc. * remove extraneous reverse Not sure where that came from * review feedback
* Fix regression in SpanInfo haddocks for local modules The regression was introduced in haskell/ghcide#630. I added `GhcSessionDeps` with the idea of reusing the typecheck GHC session for computing the SpanInfo, instead of rebuilding it from scratch. But I forgot to actually reuse it, or maybe the change got lost during the merge. * Add test
I recently discovered that the
.hi
files PR had regressed the performance ofGetSpanInfo
quite noticeably. This is due mostly to a change in the extraction ofspanInfoDoc
s. Prior to the interfaces change, these were mined out of parsed ASTs..hi
files don't come with ASTs but instead bundle the haddocks for identifiers. But to be able to use them, we need to:.hi
filesStep 1 can be sped up easily by caching a GHC session per module for files of interest, which makes
GetSpanInfo
as speedy as it used to be, as seen in the "hover after edit" experiment. I was hoping it would also speed up typechecking, but the edit experiment suggests otherwise so I might have missed something.Benchmark results (hover becomes much faster, all else stays the same):