dhall-haskell/dhall/ghc-src/Dhall
Gabriel Gonzalez a0c3be9ca1 Fix import resolution performance regression (#1522)
* Fix import resolution performance regression

Related to https://github.com/dhall-lang/dhall-haskell/issues/1511

This fixes a performance regression introduced in #1159 where `newManager`
was being called on every remote import.  This fixes that by going back to
caching the `Manager` created by the first request.

This leads to *dramatic* performance improvements for import-rich packages
(like the Prelude or `dhall-kubernetes`) on the first import.  For example,
here are the performance numbers for importing the Prelude for a cold cache
before and after this change:

Before:

```
$ XDG_CACHE_HOME=.cache time dhall hash <<< 'https://prelude.dhall-lang.org/package.dhall'
sha256:99462c205117931c0919f155a6046aec140c70fb8876d208c7c77027ab19c2fa
       64.10 real        10.83 user         2.73 sys
```

After:

```
$ XDG_CACHE_HOME=.cache2 time dhall hash <<< 'https://prelude.dhall-lang.org/package.dhall'
sha256:99462c205117931c0919f155a6046aec140c70fb8876d208c7c77027ab19c2fa
        4.39 real         0.49 user         0.15 sys
```

That's ~16x faster!

The improvement for `dhall-kubernetes` is smaller, but still significant:

Before:

```
$ XDG_CACHE_HOME=.cache3 time dhall hash <<< ~/proj/dhall-kubernetes-charts/stable/jenkins/index.dhall
sha256:04ebd960f6af331c49c3ccaedb353ac8269032b54fe0a29bd167febcd7104d4f
      833.59 real       145.36 user        36.16 sys

After:

```
$ XDG_CACHE_HOME=.cache4 time dhall hash <<< ~/proj/dhall-kubernetes-charts/stable/jenkins/index.dhall
sha256:04ebd960f6af331c49c3ccaedb353ac8269032b54fe0a29bd167febcd7104d4f
      381.41 real         8.41 user         1.91 sys
```

... or ~2-3x improvement.

* Fix `-f-with-http` build

* Remove unnecessary `CPP`

... as caught by @sjakobi
2019-11-08 18:58:03 +00:00
..
Import Fix import resolution performance regression (#1522) 2019-11-08 18:58:03 +00:00
Crypto.hs 100% haddock coverage (#1416) 2019-10-13 22:22:39 -07:00