on master help sign in
Update the compilation guide for new release
commit311cb23c5a087a1b603e246c777c36674698af83 authorHarendra Kumar <harendra@composewell.com> dateMon 16 Jan 2023, 00:14 (4 years ago) parent11e1693
1 file changed+21−35
docs/User/HowTo/Compiling.md+21−35
docs/User/HowTo/Compiling.md+21−35
@@ -4,18 +4,8 @@
44
55### Compiler (GHC) Versions
66
7−GHC 8.6 and above are recommended. For best performance use GHC 8.8 or
8−8.10 along with `fusion-plugin` (see below). Benchmarks show that GHC
9−8.8 has significantly better performance than GHC 8.6 in many cases.
10−
11−GHC 9.0 and GHC 9.2.1 have some performance issues, please see [this
12−issue](https://github.com/composewell/streamly/issues/1061) for details.
13−GHC 9.2.2 is expected to have the fixes that will bring the performance on par
14−with previous versions.
15−
16−### Distributions
17−
18−Tested with stackage `lts-18.27` and `nix 21.05`.
7+Do not use ghc 9.0.x and 9.2.1. For best performance use
8+`fusion-plugin` (see below) when compiling.
199
2010### Memory requirements
2111
@@ -23,10 +13,10 @@ Building streamly itself may require upto 4GB memory. Depending on the
2313size of the application you may require 1-16GB memory to build. For most
2414applications up to 8GB of memory should be sufficient.
2515
26−To reduce the memory footprint you may want to break big modules into
27−smaller ones and reduce unnecessary inlining on large functions. You can
28−also use the `-Rghc-timing` GHC option to report the memory usage during
29−compilation.
16+To reduce the memory footprint you may want to break big modules
17+into smaller ones and reduce unnecessary INLINE pragmas on large
18+functions. You can also use the `-Rghc-timing` GHC option to report the
19+memory usage during compilation.
3020
3121See the "Build times and space considerations" section below for more
3222details.
@@ -46,23 +36,19 @@ the cabal file and use the following GHC options:
4636 -fplugin Fusion.Plugin
4737```
4838
39+See [Explanation](#explanation) section below for details about these flags.
40+
4941Important Notes:
5042
51431. [fusion-plugin](https://hackage.haskell.org/package/fusion-plugin) can
52− improve performance significantly by better stream fusion, many
53− cases. If the perform regresses due to fusion-plugin please open
44+ improve performance significantly by better stream fusion, in many
45+ cases. If the performance regresses due to fusion-plugin please open
5446 an issue. You may remove the `-fplugin` option for regular builds
5547 but it is recommended for deployment builds and performance
56− benchmarking. Note, for GHC 8.4 or lower fusion-plugin cannot be used.
48+ benchmarking.
57492. In certain cases it is possible that GHC takes too long to compile
5850 with `-fspec-constr-recursive=16`, if that happens please reduce the
5951 value or remove that option.
60−3. At the very least `-O -fdicts-strict` compilation options are
61− absolutely required to avoid issues in some cases. For example, the
62− program `main = S.drain $ S.concatMap S.fromList $ S.repeat []` may
63− hog memory without these options.
64−
65−See [Explanation](#explanation) for details about these flags.
6652
6753#### Explanation
6854
@@ -70,19 +56,19 @@ See [Explanation](#explanation) for details about these flags.
7056issue](https://gitlab.haskell.org/ghc/ghc/issues/17745) leading to
7157memory leak in some cases.
7258
73−* `-fspec-constr-recursive` is needed for better stream fusion by enabling
74−the `SpecConstr` optimization in more cases. Large values used with this flag
75−may lead to huge compilation times and code bloat, if that happens please avoid
76−it or use a lower value (e.g. 3 or 4).
59+* `-fspec-constr-recursive` is needed for better stream fusion, it
60+allows the `SpecConstr` optimization to occur in more cases. Large
61+values used with this flag may lead to huge compilation times and code
62+bloat, if that happens please avoid it or use a lower value (e.g. 3 or
63+4).
7764
78−* `-fmax-worker-args` is needed for better stream fusion by enabling the
79−`SpecConstr` optimization in some important cases.
65+* `-fmax-worker-args` is needed for better stream fusion, it allows the
66+`SpecConstr` optimization to occur in some important cases.
8067
8168* `-fplugin=Fusion.Plugin` enables predictable stream fusion
8269optimization in certain cases by helping the compiler inline internal
83−bindings and therefore enabling case-of-case optimization. In some
84−cases, especially in some file IO benchmarks, it can make a difference of
85−5-10x better performance.
70+bindings, therefore, enabling case-of-case optimization. In some cases,
71+it can make a difference of 5-10x better performance.
8672
8773### Multi-core Parallelism
8874
@@ -121,7 +107,7 @@ more details.
121107
122108### Nix build
123109
124−Please note that cabal2nix may not always be able to generate a complete nix
110+Please note that `cabal2nix` may not always be able to generate a complete nix
125111expression on `macOS`. See [this
126112issue](https://github.com/NixOS/cabal2nix/issues/470).
127113