haskell-language-server/hls-graph/README.md
Pepe Iborra 682386d1c9
Reimplement shake (continued) (#2060)
* Rewrite hls-graph to not use the Shake code

* redundant import

* Fix the bug

* add comments and format imports

* Fix another bug

* fix locking in incDatabase

* avoid calling withNumCapabilities on every build

* faster cleanup

* implement reverse deps

* --conservative-change-tracking

* Avoid grabbing the db lock when updating reverse deps

* update reverse deps asynchronously

* Profiling graph builds

* extend up profiling to record visiting steps

The main benefit of reverse dependency tracking is that we avoid unnecessary node lookups. However, these lookups were not shown in hls-graph profiles, hiding their real cost.

Concretely, if the number of lookups per build is proportional to the number of transitive dependencies of a node, which in turn is proportional to the number of transitive imports of a module, then we have an O(edges) complexity instead of an O(nodes) complexity, which is really bad for large projects.

This Diff extends the recorded data and the profiling UI to keep track
of visited nodes and to show them in a new column "Visited" of the "Rules" tab. The cost of doing this is storing an additional Int per node at runtime.

While I was editing the profiling UI, I took the chance to remove the command tabs, update the README and add some missing files

* include dirty set in profiles

* actionFork

* avoid spawning threads for simple lookups

* Fix a flaky test

* record changes to GetKnownTargets

* Readme for hls-graph

* Bump version numbers

* Drop dependency on Shake

* explain why we restart a Shake session

* clean up Internal.Database

* add a new benchmark example cabal-1module

* Fix masking and further reduce threading

* Trace aborted rule evaluations

* Fix code actions after cradle edit experiment

* Avoid spawning threads for build rules with 1 or fewer deps

* simplify a test

* hlint

* Add a test for off-editor changes

* Fix flaky tests

* fix incomplete pattern match in Tactics test suite

* Fix flaky tests

* attempt to fix tactics test suite in Windows

Co-authored-by: Neil Mitchell <ndmitchell@gmail.com>
2021-09-25 10:23:52 +00:00

766 B

hls-graph - a limited reimplementation of Shake for in-memory build graphs

ghcide was originally built on top of Shake, a Haskell build system. Nowadays Shake has been replaced by a special purpose implementation of a build graph called hls-graph, which drops all the persistency features in exchange for simplicity and performance.

Features:

  • Dynamic dependencies
  • User defined rules (there are no predefined File rules as in Shake)
  • Build reports (a la Shake profiling)
  • "Reactive" change tracking for minimal rebuilds (not available in Shake)

What's missing:

  • Persistence
  • A default set of rules for file system builds
  • A testsuite
  • General purpose application - many design decisions make assumptions specific to ghcide