summaryrefslogtreecommitdiff
path: root/docs/users_guide
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2020-01-28 20:53:04 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-05-27 02:35:11 -0400
commit03d69e4bb6b92ccd8238bebd9cff68da23741f49 (patch)
tree4dbaf811ec9bda4c9544530f63509ad8c7062bc3 /docs/users_guide
parent9faafb0aaff04e86a58b9e108f84618b12f2057c (diff)
downloadhaskell-03d69e4bb6b92ccd8238bebd9cff68da23741f49.tar.gz
Enable strict dicts by default at -O2.
In the common case this is a straight performance win at a compile time cost so we enable it at -O2. In rare cases it can lead to compile time regressions because of changed inlining behaviour. Which can very rarely also affect runtime performance. Increasing the inlining threshold can help to avoid this which is documented in the user guide. In terms of measured results this reduced instructions executed for nofib by 1%. However for some cases (e.g. Cabal) enabling this by default increases compile time by 2-3% so we enable it only at -O2 where it's clear that a user is willing to trade compile time for runtime. Most of the testsuite runs without -O2 so there are few perf changes. Increases: T12545/T18698: We perform more WW work because dicts are now treated strict. T9198: Also some more work because functions are now subject to W/W Decreases: T14697: Compiling empty modules. Probably because of changes inside ghc. T9203: I can't reproduce this improvement locally. Might be spurious. ------------------------- Metric Decrease: T12227 T14697 T9203 Metric Increase: T9198 T12545 T18698a T18698b -------------------------
Diffstat (limited to 'docs/users_guide')
-rw-r--r--docs/users_guide/using-optimisation.rst11
1 files changed, 10 insertions, 1 deletions
diff --git a/docs/users_guide/using-optimisation.rst b/docs/users_guide/using-optimisation.rst
index 3fcac45e11..31d3a71431 100644
--- a/docs/users_guide/using-optimisation.rst
+++ b/docs/users_guide/using-optimisation.rst
@@ -343,7 +343,7 @@ by saying ``-fno-wombat``.
seem cheap to the optimiser.
.. ghc-flag:: -fdicts-strict
- :shortdesc: Make dictionaries strict
+ :shortdesc: Make dictionaries strict. Implied by :ghc-flag:`-O2`.
:type: dynamic
:reverse: -fno-dicts-strict
:category:
@@ -352,6 +352,15 @@ by saying ``-fno-wombat``.
Make dictionaries strict.
+ This enables WW to fire on dictionary constraints which usually results
+ in better runtime. In niche cases it can lead to significant compile time
+ regressions because of changed inlining behaviour. Rarely this can also affect
+ runtime negatively.
+
+ If enabling this flag leads to regressions try increasing the unfolding
+ threshold using :ghc-flag:`-funfolding-use-threshold=⟨n⟩` by a modest amount (~30)
+ as this is likely a result of a known limitation described in `#18421`.
+
.. ghc-flag:: -fdmd-tx-dict-sel
:shortdesc: *(deprecated)* Use a special demand transformer for dictionary selectors.
:type: dynamic