dhall-haskell/dhall-lsp-server/src/Dhall/LSP/Backend
Gabriel Gonzalez b843cae5d2
Improve encoding/decoding speed (#1500)
... by not going through a `Term` intermediate

This gives a ~28% performance in decoding improvement, which means that
cache looks are not faster.

Here are the new decoding benchmarks before and after this change:

Before:

```
benchmarked Issue #108/Binary
time                 266.5 μs   (265.7 μs .. 267.4 μs)
                     1.000 R²   (1.000 R² .. 1.000 R²)
mean                 266.3 μs   (265.6 μs .. 267.1 μs)
std dev              2.418 μs   (1.891 μs .. 3.436 μs)

benchmarking Kubernetes/Binary ... took 36.94 s, total 56 iterations
benchmarked Kubernetes/Binary
time                 641.3 ms   (623.0 ms .. 655.4 ms)
                     0.999 R²   (0.997 R² .. 1.000 R²)
mean                 679.7 ms   (665.5 ms .. 702.6 ms)
std dev              29.48 ms   (14.15 ms .. 39.05 ms)
```

After:

```
benchmarked Issue #108/Binary
time                 282.2 μs   (279.6 μs .. 284.7 μs)
                     1.000 R²   (0.999 R² .. 1.000 R²)
mean                 281.9 μs   (280.7 μs .. 287.7 μs)
std dev              7.089 μs   (2.550 μs .. 15.44 μs)
variance introduced by outliers: 11% (moderately inflated)

benchmarking Kubernetes/Binary ... took 27.57 s, total 56 iterations
benchmarked Kubernetes/Binary
time                 499.1 ms   (488.1 ms .. 506.6 ms)
                     0.999 R²   (0.998 R² .. 1.000 R²)
mean                 498.9 ms   (494.4 ms .. 503.9 ms)
std dev              8.539 ms   (6.236 ms .. 12.56 ms)
```

There's a slight performance regression for the decoding microbenchmark, but
in practice my testing on real examples matches performance improvements seen
in the larger benchmark based on an example cache product from
`dhall-kubernetes`.

Note that is a breaking change because:

* There is no longer a `FromTerm` nor `ToTerm` class.  Now we use the
  `Serialise` class and `{encode,decode}Expression` now work on `ByteString`s
  instead of `Term`s

* I further narrowed the types of several encoding/decoding utilites to expect a
  `Void` for the first type parameter of `Expr`

* This is a regression with respect to stripping 55799 CBOR tags, mainly
  because properly handling the tags at every possible point in the syntax tree
  would considerably complicate the code
2019-10-31 20:05:22 -07:00
..
Completion.hs Fix dhall-lsp-server to be "-Wall clean" (#1446) (#1449) 2019-10-21 12:54:00 +00:00
Dhall.hs Improve encoding/decoding speed (#1500) 2019-10-31 20:05:22 -07:00
Diagnostics.hs Only underline link in import (#1217) 2019-08-08 13:42:49 +00:00
Formatting.hs Test that dhall format is idempotent (#1427) 2019-10-22 19:45:08 +02:00
Freezing.hs dhall-lsp-server: Freezing imports (#1123) 2019-07-19 17:24:11 +00:00
Linting.hs Fix dhall format to preserve let comments (#1273) 2019-09-04 23:41:44 -05:00
Parsing.hs Improve parsing error messages (#1443) 2019-10-27 03:34:33 +00:00
ToJSON.hs dhall-lsp-server: Implement caching (#1040) 2019-07-01 17:30:32 +00:00
Typing.hs 100% haddock coverage (#1416) 2019-10-13 22:22:39 -07:00