haskell-servant / haskell-servant/servant
compile time quadratic in number of routes, with -O2
- Dominant language
- Haskell
- Stars
- 2k
- Forks
- 427
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 5
Description
I've been digging a bit to understand where time is spent while building my $WORK codebase, and found this interesting behavior. I'm hoping others interested in investigating the root cause will discuss here. I'm open to changes in application code, servant, or GHC, if we can narrow the cause enough.
The small examples I'm using for benchmarking are at https://github.com/bergey/studious-telegram/tree/trunk/servant
I'm timing with [bench](https://github.com/Gabriel439/bench/) invoked as `bench 'stack clean && stack build`. I'm running on a GCP VM with nothing else running on it.
With `stack build --fast` (which I believe passes -O0 to GHC), the build time doesn't change dramatically as the number of HTTP routes increases. Without `--fast`:
number of routes | time (seconds)
--- | ---
1 | 4
8 | 4.8
16 | 7
32 | 16.3
64 | 74
The only mitigation I've found so far is testing as much as possible in GHCi or with `--fast`. This may be related to #870; I have not yet tested with anything except stackage-11.14, which has GHC-8.2.2 and servant-0.13.0.1.
Contributor guide
Assessment
This issue has not been assessed yet.