Recommend switching to non-moving garbage collector

This commit is contained in:
Bodigrim 2021-03-20 23:33:50 +00:00
parent 6d0e0b107a
commit 291c6b7659
2 changed files with 14 additions and 2 deletions

View File

@ -78,8 +78,11 @@ synopsis: Example of a benchmark
benchmark bench-fibo
main-is: BenchFibo.hs
type: exitcode-stdio-1.0
ghc-options: "-with-rtsopts=-A32m"
build-depends: base, tasty-bench
if impl(ghc >= 8.10)
ghc-options: "-with-rtsopts=-A32m --nonmoving-gc"
else
ghc-options: "-with-rtsopts=-A32m"
```
And here is `BenchFibo.hs`:
@ -290,6 +293,9 @@ look for another way to speed up generation of Fibonacci numbers.
Alternatively bake it into
`cabal` file as `ghc-options: "-with-rtsopts=-A32m"`.
For GHC >= 8.10 consider switching benchmarks to a non-moving garbage collector,
because it decreases GC pauses and corresponding noise: `+RTS --nonmoving-gc`.
* If benchmark results look malformed like below, make sure that you are
invoking `Test.Tasty.Bench.defaultMain` and not `Test.Tasty.defaultMain`
(the difference is `consoleBenchReporter` vs. `consoleTestReporter`):

View File

@ -65,8 +65,11 @@ Benchmarks are declared in a separate section of @cabal@ file:
> benchmark bench-fibo
> main-is: BenchFibo.hs
> type: exitcode-stdio-1.0
> ghc-options: "-with-rtsopts=-A32m"
> build-depends: base, tasty-bench
> if impl(ghc >= 8.10)
> ghc-options: "-with-rtsopts=-A32m --nonmoving-gc"
> else
> ghc-options: "-with-rtsopts=-A32m"
And here is @BenchFibo.hs@:
@ -261,6 +264,9 @@ another way to speed up generation of Fibonacci numbers.
@stack@ @bench@ @--ba@ @\'+RTS@ @-A32m\'@. Alternatively bake it into @cabal@
file as @ghc-options:@ @\"-with-rtsopts=-A32m\"@.
For GHC >= 8.10 consider switching benchmarks to a non-moving garbage collector,
because it decreases GC pauses and corresponding noise: @+RTS@ @--nonmoving-gc@.
- If benchmark results look malformed like below, make sure that you
are invoking 'Test.Tasty.Bench.defaultMain' and not
'Test.Tasty.defaultMain' (the difference is 'consoleBenchReporter'