MonoidMusician/dhall-purescript

Performance

Opened this issue · 0 comments

Performance is ... not great. A list of performance improvements that I know need to be made:

  • Exploit sharing during normalization. Allow more sharing during typechecking, by allowing the algorithm to return full Oxpr nodes when possible ...
  • Perform fewer traversals, especially during imports. (The code is elegant, but currently each operation walks the whole tree.) And certainly while updating Lxprs ...
  • Use Halogen components and thunks to add render boundaries to the VDOM so there are fewer updates, and, ideally, work could be shared across views.

In general, reducing allocations and doing less work is imperative, and they often go hand-in-hand.

One of the more extreme ideas I have is using JS objects and their referential semantics to aggressively memoize operations. Each function, like normalization, would generate a JS symbol, which is then used to attach extra data to objects that pass through, memoizing them. Care needs to be taken for things like typechecking that receive two arguments, probably it would only cache in an empty context.