GHC 8.6 and above are recommended. For best performance use GHC 8.8 or 8.10 along with
fusion-plugin (see below). Benchmarks show that GHC 8.8 has significantly better performance than GHC 8.6 in many cases.
GHC 9.0 has some performance issues, please see this issue for details. However, upcoming minor version updates may fix some of these issues.
Tested with stackage
Building streamly itself may require upto 4GB memory. Depending on the size of the application you may require 1-16GB memory to build. For most applications up to 8GB of memory should be sufficient.
To reduce the memory footprint you may want to break big modules into smaller ones and reduce unnecessary inlining on large functions. You can also use the
-Rghc-timing GHC option to report the memory usage during compilation.
See the “Build times and space considerations” section below for more details.
fusion-plugin to the
build-depends section of your program in the cabal file and use the following GHC options:
-O2 -fdicts-strict -fmax-worker-args=16 -fspec-constr-recursive=16 -fplugin Fusion.Plugin
-fpluginoption for regular builds but it is recommended for deployment builds and performance benchmarking. Note, for GHC 8.4 or lower fusion-plugin cannot be used.
-fspec-constr-recursive=16, if that happens please reduce the value or remove that option.
-O -fdicts-strictcompilation options are absolutely required to avoid issues in some cases. For example, the program
main = S.drain $ S.concatMap S.fromList $ S.repeat may hog memory without these options.
See Explanation for details about these flags.
-fdicts-strict is needed to avoid a GHC issue leading to memory leak in some cases.
-fspec-constr-recursive is needed for better stream fusion by enabling the
SpecConstr optimization in more cases. Large values used with this flag may lead to huge compilation times and code bloat, if that happens please avoid it or use a lower value (e.g. 3 or 4).
-fmax-worker-args is needed for better stream fusion by enabling the
SpecConstr optimization in some important cases.
-fplugin=Fusion.Plugin enables predictable stream fusion optimization in certain cases by helping the compiler inline internal bindings and therefore enabling case-of-case optimization. In some cases, especially in some file IO benchmarks, it can make a difference of 5-10x better performance.
Concurrency without a threaded runtime may be a bit more efficient. Do not use threaded runtime unless you really need multi-core parallelism. To get multi-core parallelism use the following GHC options:
-threaded -with-rtsopts "-N"
Streamly supports Linux, macOS and Windows operating systems. Some modules and functionality may depend on specific OS kernel features. Features/modules may get disabled if the kernel/OS does not support it.
Cocoaframework). However, we only test on latest three versions of the OS.