summaryrefslogtreecommitdiff
path: root/docs/users_guide/using-optimisation.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/users_guide/using-optimisation.rst')
-rw-r--r--docs/users_guide/using-optimisation.rst449
1 files changed, 202 insertions, 247 deletions
diff --git a/docs/users_guide/using-optimisation.rst b/docs/users_guide/using-optimisation.rst
index 84bf27b4d4..bc8e70036e 100644
--- a/docs/users_guide/using-optimisation.rst
+++ b/docs/users_guide/using-optimisation.rst
@@ -45,39 +45,35 @@ optimisation to be performed, which can have an impact on how much of
your program needs to be recompiled when you change something. This is
one reason to stick to no-optimisation when developing code.
-``-O*``
- .. index::
- single: -O\* not specified
+.. ghc-flag:: -O*
This is taken to mean: “Please compile quickly; I'm not
over-bothered about compiled-code quality.” So, for example:
``ghc -c Foo.hs``
-``-O0``
- .. index::
- single: -O0
+.. ghc-flag:: -O0
Means "turn off all optimisation", reverting to the same settings as
if no ``-O`` options had been specified. Saying ``-O0`` can be
- useful if eg. ``make`` has inserted a ``-O`` on the command line
+ useful if e.g. ``make`` has inserted a ``-O`` on the command line
already.
-``-O``, ``-O1``
+.. ghc-flag:: -O
+ -O1
+
.. index::
- single: -O option
- single: -O1 option
single: optimise; normally
Means: "Generate good-quality code without taking too long about
it." Thus, for example: ``ghc -c -O Main.lhs``
-``-O2``
+.. ghc-flag:: -O2
+
.. index::
- single: -O2 option
single: optimise; aggressively
Means: "Apply every non-dangerous optimisation, even if it means
- significantly longer compile times."
+ significantly longer compile times."
The avoided "dangerous" optimisations are those that can make
runtime or space *worse* if you're unlucky. They are normally turned
@@ -86,9 +82,9 @@ one reason to stick to no-optimisation when developing code.
At the moment, ``-O2`` is *unlikely* to produce better code than
``-O``.
-``-Odph``
+.. ghc-flag:: -Odph
+
.. index::
- single: -Odph
single: optimise; DPH
Enables all ``-O2`` optimisation, sets
@@ -101,7 +97,7 @@ to go for broke, we tend to use ``-O2`` (and we go for lots of coffee
breaks).
The easiest way to see what ``-O`` (etc.) “really mean” is to run with
-``-v``, then stand back in amazement.
+:ghc-flag:`-v`, then stand back in amazement.
.. _options-f:
@@ -113,19 +109,17 @@ The easiest way to see what ``-O`` (etc.) “really mean” is to run with
single: -fno-\* options (GHC)
These flags turn on and off individual optimisations. Flags marked as
-*Enabled by default* are enabled by ``-O``, and as such you shouldn't
+on by default are enabled by ``-O``, and as such you shouldn't
need to set any of them explicitly. A flag ``-fwombat`` can be negated
by saying ``-fno-wombat``. See :ref:`options-f-compact` for a compact
list.
-``-fcase-merge``
- .. index::
- single: -fcase-merge
+.. ghc-flag:: -fcase-merge
- *On by default.* Merge immediately-nested case expressions that
- scrutinse the same variable. For example,
+ :default: on
- ::
+ Merge immediately-nested case expressions that scrutinse the same variable.
+ For example, ::
case x of
Red -> e1
@@ -133,98 +127,85 @@ list.
Blue -> e2
Green -> e3
- Is transformed to,
+ Is transformed to, ::
- ::
case x of
Red -> e1
Blue -> e2
Green -> e2
-``-fcall-arity``
- .. index::
- single: -fcall-arity
+.. ghc-flag:: -fcall-arity
- *On by default.*.
+ :default: on
-``-fcmm-elim-common-blocks``
- .. index::
- single: -felim-common-blocks
+ Enable call-arity analysis.
+
+.. ghc-flag:: -fcmm-elim-common-blocks
+
+ :default: on
- *On by default.*. Enables the common block elimination optimisation
+ Enables the common block elimination optimisation
in the code generator. This optimisation attempts to find identical
Cmm blocks and eliminate the duplicates.
-``-fcmm-sink``
- .. index::
- single: -fcmm-sink
+.. ghc-flag:: -fcmm-sink
+
+ :default: on
- *On by default.*. Enables the sinking pass in the code generator.
+ Enables the sinking pass in the code generator.
This optimisation attempts to find identical Cmm blocks and
eliminate the duplicates attempts to move variable bindings closer
to their usage sites. It also inlines simple expressions like
literals or registers.
-``-fcpr-off``
- .. index::
- single: -fcpr-Off
+.. ghc-flag:: -fcpr-off
Switch off CPR analysis in the demand analyser.
-``-fcse``
- .. index::
- single: -fcse
+.. ghc-flag:: -fcse
+
+ :default: on
- *On by default.*. Enables the common-sub-expression elimination
+ Enables the common-sub-expression elimination
optimisation. Switching this off can be useful if you have some
``unsafePerformIO`` expressions that you don't want commoned-up.
-``-fdicts-cheap``
- .. index::
- single: -fdicts-cheap
+.. ghc-flag:: -fdicts-cheap
A very experimental flag that makes dictionary-valued expressions
seem cheap to the optimiser.
-``-fdicts-strict``
- .. index::
- single: -fdicts-strict
+.. ghc-flag:: -fdicts-strict
Make dictionaries strict.
-``-fdmd-tx-dict-sel``
- .. index::
- single: -fdmd-tx-dict-sel
+.. ghc-flag:: -fdmd-tx-dict-sel
*On by default for ``-O0``, ``-O``, ``-O2``.*
Use a special demand transformer for dictionary selectors.
-``-fdo-eta-reduction``
- .. index::
- single: -fdo-eta-reduction
+.. ghc-flag:: -fdo-eta-reduction
- *On by default.* Eta-reduce lambda expressions, if doing so gets rid
- of a whole group of lambdas.
+ :default: on
-``-fdo-lambda-eta-expansion``
- .. index::
- single: -fdo-lambda-eta-expansion
+ Eta-reduce lambda expressions, if doing so gets rid of a whole group of
+ lambdas.
- *On by default.* Eta-expand let-bindings to increase their arity.
+.. ghc-flag:: -fdo-lambda-eta-expansion
-``-feager-blackholing``
- .. index::
- single: -feager-blackholing
+ :default: on
+
+ Eta-expand let-bindings to increase their arity.
+
+.. ghc-flag:: -feager-blackholing
Usually GHC black-holes a thunk only when it switches threads. This
flag makes it do so as soon as the thunk is entered. See `Haskell on
a shared-memory
multiprocessor <http://research.microsoft.com/en-us/um/people/simonpj/papers/parallel/>`__.
-``-fexcess-precision``
- .. index::
- single: -fexcess-precision
+.. ghc-flag:: -fexcess-precision
When this option is given, intermediate floating point values can
have a *greater* precision/range than the final type. Generally this
@@ -237,19 +218,17 @@ list.
``-fno-excess-precision`` has any effect. This is a known bug, see
:ref:`bugs-ghc`.
-``-fexpose-all-unfoldings``
- .. index::
- single: -fexpose-all-unfoldings
+.. ghc-flag:: -fexpose-all-unfoldings
An experimental flag to expose all unfoldings, even for very large
or recursive functions. This allows for all functions to be inlined
while usually GHC would avoid inlining larger functions.
-``-ffloat-in``
- .. index::
- single: -ffloat-in
+.. ghc-flag:: -ffloat-in
+
+ :default: on
- *On by default.* Float let-bindings inwards, nearer their binding
+ Float let-bindings inwards, nearer their binding
site. See `Let-floating: moving bindings to give faster programs
(ICFP'96) <http://research.microsoft.com/en-us/um/people/simonpj/papers/float.ps.gz>`__.
@@ -266,11 +245,11 @@ list.
grouped into a larger single let binding, effectively batching their
allocation and helping the garbage collector and allocator.
-``-ffull-laziness``
- .. index::
- single: -ffull-laziness
+.. ghc-flag:: -ffull-laziness
+
+ :default: on
- *On by default.* Run the full laziness optimisation (also known as
+ Run the full laziness optimisation (also known as
let-floating), which floats let-bindings outside enclosing lambdas,
in the hope they will be thereby be computed less often. See
`Let-floating: moving bindings to give faster programs
@@ -287,143 +266,124 @@ list.
difference is that GHC doesn't consistently apply full-laziness, so
don't rely on it.
-``-ffun-to-thunk``
- .. index::
- single: -ffun-to-thunk
+.. ghc-flag:: -ffun-to-thunk
+
+ :default: off
Worker-wrapper removes unused arguments, but usually we do not
remove them all, lest it turn a function closure into a thunk,
thereby perhaps creating a space leak and/or disrupting inlining.
- This flag allows worker/wrapper to remove *all* value lambdas. Off
- by default.
+ This flag allows worker/wrapper to remove *all* value lambdas.
-``-fignore-asserts``
- .. index::
- single: -fignore-asserts
+.. ghc-flag:: -fignore-asserts
- *On by default.*. Causes GHC to ignore uses of the function
- ``Exception.assert`` in source code (in other words, rewriting
- ``Exception.assert p e`` to ``e`` (see :ref:`assertions`).
+ :default: on
-``-fignore-interface-pragmas``
- .. index::
- single: -fignore-interface-pragmas
+ Causes GHC to ignore uses of the function ``Exception.assert`` in source
+ code (in other words, rewriting ``Exception.assert p e`` to ``e`` (see
+ :ref:`assertions`).
+
+.. ghc-flag:: -fignore-interface-pragmas
Tells GHC to ignore all inessential information when reading
- interface files. That is, even if ``M.hi`` contains unfolding or
+ interface files. That is, even if :file:`M.hi` contains unfolding or
strictness information for a function, GHC will ignore that
information.
-``-flate-dmd-anal``
- .. index::
- single: -flate-dmd-anal
+.. ghc-flag:: -flate-dmd-anal
Run demand analysis again, at the end of the simplification
pipeline. We found some opportunities for discovering strictness
that were not visible earlier; and optimisations like
- ``-fspec-constr`` can create functions with unused arguments which
+ :ghc-flag:`-fspec-constr` can create functions with unused arguments which
are eliminated by late demand analysis. Improvements are modest, but
so is the cost. See notes on the :ghc-wiki:`Trac wiki page <LateDmd>`.
-``-fliberate-case``
- .. index::
- single: -fliberate-case
+.. ghc-flag:: -fliberate-case
*Off by default, but enabled by -O2.* Turn on the liberate-case
transformation. This unrolls recursive function once in its own RHS,
to avoid repeated case analysis of free variables. It's a bit like
- the call-pattern specialiser (``-fspec-constr``) but for free
+ the call-pattern specialiser (:ghc-flag:`-fspec-constr`) but for free
variables rather than arguments.
-``-fliberate-case-threshold=n``
- .. index::
- single: -fliberate-case-threshold
+.. ghc-flag:: -fliberate-case-threshold=<n>
- *default: 2000.* Set the size threshold for the liberate-case
- transformation.
+ :default: 2000
-``-floopification``
- .. index::
- single: -floopification
+ Set the size threshold for the liberate-case transformation.
- *On by default.*
+.. ghc-flag:: -floopification
+
+ :default: on
When this optimisation is enabled the code generator will turn all
self-recursive saturated tail calls into local jumps rather than
function calls.
-``-fmax-inline-alloc-size=n``
- .. index::
- single: -fmax-inline-alloc-size
+.. ghc-flag:: -fmax-inline-alloc-size=<n>
+
+ :default: 128
- *default: 128.* Set the maximum size of inline array allocations to n bytes.
+ Set the maximum size of inline array allocations to n bytes.
GHC will allocate non-pinned arrays of statically known size in the current
nursery block if they're no bigger than n bytes, ignoring GC overheap. This
value should be quite a bit smaller than the block size (typically: 4096).
-``-fmax-inline-memcpy-insn=n``
- .. index::
- single: -fmax-inline-memcpy-insn
+.. ghc-flag:: -fmax-inline-memcpy-insn=<n>
- *default: 32.* Inline ``memcpy`` calls if they would generate no more than n pseudo
- instructions.
+ :default: 32
-``-fmax-inline-memset-insns=n``
- .. index::
- single: -fmax-inline-memset-insns
+ Inline ``memcpy`` calls if they would generate no more than ⟨n⟩ pseudo-instructions.
- *default: 32.* Inline ``memset`` calls if they would generate no more than n pseudo
+.. ghc-flag:: -fmax-inline-memset-insns=<n>
+
+ :default: 32
+
+ Inline ``memset`` calls if they would generate no more than n pseudo
instructions.
-``-fmax-relevant-binds=n``
- .. index::
- single: -fmax-relevant-bindings
+.. ghc-flag:: -fmax-relevant-binds=<n>
+ -fno-max-relevant-bindings
+
+ :default: 6
The type checker sometimes displays a fragment of the type
environment in error messages, but only up to some maximum number,
- set by this flag. The default is 6. Turning it off with
+ set by this flag. Turning it off with
``-fno-max-relevant-bindings`` gives an unlimited number.
Syntactically top-level bindings are also usually excluded (since
they may be numerous), but ``-fno-max-relevant-bindings`` includes
them too.
-``-fmax-simplifier-iterations=n``
- .. index::
- single: -fmax-simplifier-iterations
+.. ghc-flag:: -fmax-simplifier-iterations=<n>
- *default: 4.* Sets the maximal number of iterations for the simplifier.
+ :default: 4
-``-fmax-worker-args=n``
- .. index::
- single: -fmax-worker-args
+ Sets the maximal number of iterations for the simplifier.
- *default: 10.* If a worker has that many arguments, none will be unpacked
- anymore.
+.. ghc-flag:: -fmax-worker-args=<n>
-``-fno-opt-coercion``
- .. index::
- single: -fno-opt-coercion
+ :default: 10
+
+ If a worker has that many arguments, none will be unpacked anymore.
+
+.. ghc-flag:: -fno-opt-coercion
Turn off the coercion optimiser.
-``-fno-pre-inlining``
- .. index::
- single: -fno-pre-inlining
+.. ghc-flag:: -fno-pre-inlining
Turn off pre-inlining.
-``-fno-state-hack``
- .. index::
- single: -fno-state-hack
+.. ghc-flag:: -fno-state-hack
Turn off the "state hack" whereby any lambda with a ``State#`` token
as argument is considered to be single-entry, hence it is considered
- OK to inline things inside it. This can improve performance of IO
+ okay to inline things inside it. This can improve performance of IO
and ST monad code, but it runs the risk of reducing sharing.
-``-fomit-interface-pragmas``
- .. index::
- single: -fomit-interface-pragmas
+.. ghc-flag:: -fomit-interface-pragmas
Tells GHC to omit all inessential information from the interface
file generated for the module being compiled (say M). This means
@@ -434,11 +394,11 @@ list.
need to be recompiled less often (only when M's exports change their
type, not when they change their implementation).
-``-fomit-yields``
- .. index::
- single: -fomit-yields
+.. ghc-flag:: -fomit-yields
- *On by default.* Tells GHC to omit heap checks when no allocation is
+ :default: on
+
+ Tells GHC to omit heap checks when no allocation is
being performed. While this improves binary sizes by about 5%, it
also means that threads run in tight non-allocating loops will not
get preempted in a timely fashion. If it is important to always be
@@ -446,18 +406,14 @@ list.
off. Consider also recompiling all libraries with this optimization
turned off, if you need to guarantee interruptibility.
-``-fpedantic-bottoms``
- .. index::
- single: -fpedantic-bottoms
+.. ghc-flag:: -fpedantic-bottoms
Make GHC be more precise about its treatment of bottom (but see also
- ``-fno-state-hack``). In particular, stop GHC eta-expanding through
+ :ghc-flag:`-fno-state-hack`). In particular, stop GHC eta-expanding through
a case expression, which is good for performance, but bad if you are
using ``seq`` on partial applications.
-``-fregs-graph``
- .. index::
- single: -fregs-graph
+.. ghc-flag:: -fregs-graph
*Off by default due to a performance regression bug. Only applies in
combination with the native code generator.* Use the graph colouring
@@ -466,9 +422,7 @@ list.
allocator. The downside being that the linear register allocator
usually generates worse code.
-``-fregs-iterative``
- .. index::
- single: -fregs-iterative
+.. ghc-flag:: -fregs-iterative
*Off by default, only applies in combination with the native code
generator.* Use the iterative coalescing graph colouring register
@@ -476,18 +430,17 @@ list.
is the same register allocator as the ``-fregs-graph`` one but also
enables iterative coalescing during register allocation.
-``-fsimplifier-phases=n``
- .. index::
- single: -fsimplifier-phases
+.. ghc-flag:: -fsimplifier-phases=<n>
- *default: 2.* Set the number of phases for the simplifier. Ignored
- with -O0.
+ :default: 2
-``-fsimpl-tick-factor=n``
- .. index::
- single: -fsimpl-tick-factor
+ Set the number of phases for the simplifier. Ignored with ``-O0``.
- *default: 100.* GHC's optimiser can diverge if you write rewrite rules
+.. ghc-flag:: -fsimpl-tick-factor=<n>
+
+ :default: 100
+
+ GHC's optimiser can diverge if you write rewrite rules
(:ref:`rewrite-rules`) that don't terminate, or (less satisfactorily)
if you code up recursion through data types (:ref:`bugs-ghc`). To
avoid making the compiler fall into an infinite loop, the optimiser
@@ -503,18 +456,14 @@ list.
more detailed list. Usually that identifies the loop quite
accurately, because some numbers are very large.
-``-fspec-constr``
- .. index::
- single: -fspec-constr
+.. ghc-flag:: -fspec-constr
*Off by default, but enabled by -O2.* Turn on call-pattern
specialisation; see `Call-pattern specialisation for Haskell
programs <http://research.microsoft.com/en-us/um/people/simonpj/papers/spec-constr/index.htm>`__.
This optimisation specializes recursive functions according to their
- argument "shapes". This is best explained by example so consider:
-
- ::
+ argument "shapes". This is best explained by example so consider: ::
last :: [a] -> a
last [] = error "last"
@@ -523,9 +472,7 @@ list.
In this code, once we pass the initial check for an empty list we
know that in the recursive case this pattern match is redundant. As
- such ``-fspec-constr`` will transform the above code to:
-
- ::
+ such ``-fspec-constr`` will transform the above code to: ::
last :: [a] -> a
last [] = error "last"
@@ -545,9 +492,7 @@ list.
necessary for some highly optimized libraries, where we may want to
specialize regardless of the number of specialisations, or the size
of the code. As an example, consider a simplified use-case from the
- ``vector`` library:
-
- ::
+ ``vector`` library: ::
import GHC.Types (SPEC(..))
@@ -573,52 +518,50 @@ list.
body directly, allowing heavy specialisation over the recursive
cases.
-``-fspec-constr-count=n``
- .. index::
- single: -fspec-constr-count
+.. ghc-flag:: -fspec-constr-count=<n>
+
+ :default: 3
- *default: 3.* Set the maximum number of specialisations that will be created for
+ Set the maximum number of specialisations that will be created for
any one function by the SpecConstr transformation.
-``-fspec-constr-threshold=n``
- .. index::
- single: -fspec-constr-threshold
+.. ghc-flag:: -fspec-constr-threshold=<n>
- *default: 2000.* Set the size threshold for the SpecConstr transformation.
+ :default: 2000
-``-fspecialise``
- .. index::
- single: -fspecialise
+ Set the size threshold for the SpecConstr transformation.
+
+.. ghc-flag:: -fspecialise
+
+ :default: on
- *On by default.* Specialise each type-class-overloaded function
+ Specialise each type-class-overloaded function
defined in this module for the types at which it is called in this
- module. If ``-fcross-module-specialise`` is set imported functions
+ module. If :ghc-flag:`-fcross-module-specialise` is set imported functions
that have an INLINABLE pragma (:ref:`inlinable-pragma`) will be
specialised as well.
-``-fcross-module-specialise``
- .. index::
- single: -fcross-module-specialise
+.. ghc-flag:: -fcross-module-specialise
+
+ :default: on
- *On by default.* Specialise ``INLINABLE`` (:ref:`inlinable-pragma`)
+ Specialise ``INLINABLE`` (:ref:`inlinable-pragma`)
type-class-overloaded functions imported from other modules for the types at
which they are called in this module. Note that specialisation must be
enabled (by ``-fspecialise``) for this to have any effect.
-``-fstatic-argument-transformation``
- .. index::
- single: -fstatic-argument-transformation
+.. ghc-flag:: -fstatic-argument-transformation
Turn on the static argument transformation, which turns a recursive
function into a non-recursive one with a local recursive loop. See
Chapter 7 of `Andre Santos's PhD
thesis <http://research.microsoft.com/en-us/um/people/simonpj/papers/santos-thesis.ps.gz>`__
-``-fstrictness``
- .. index::
- single: -fstrictness
+.. ghc-flag:: -fstrictness
- *On by default.*. Switch on the strictness analyser. There is a very
+ :default: on
+
+ Switch on the strictness analyser. There is a very
old paper about GHC's strictness analyser, `Measuring the
effectiveness of a simple strictness
analyser <http://research.microsoft.com/en-us/um/people/simonpj/papers/simple-strictnes-analyser.ps.gz>`__,
@@ -631,27 +574,25 @@ list.
they change the semantics of the program when applied to lazy
arguments.
-``-fstrictness-before=⟨n⟩``
- .. index::
- single: -fstrictness-before
+.. ghc-flag:: -fstrictness-before=⟨n⟩
Run an additional strictness analysis before simplifier phase ⟨n⟩.
-``-funbox-small-strict-fields``
+.. ghc-flag:: -funbox-small-strict-fields
+
+ :default: on
+
.. index::
- single: -funbox-small-strict-fields
single: strict constructor fields
single: constructor fields, strict
- *On by default.*. This option causes all constructor fields which
+ This option causes all constructor fields which
are marked strict (i.e. “!”) and which representation is smaller or
equal to the size of a pointer to be unpacked, if possible. It is
equivalent to adding an ``UNPACK`` pragma (see :ref:`unpack-pragma`)
to every strict constructor field that fulfils the size restriction.
- For example, the constructor fields in the following data types
-
- ::
+ For example, the constructor fields in the following data types ::
data A = A !Int
data B = B !A
@@ -672,14 +613,14 @@ list.
constructor fields are unpacked on 32-bit platforms, even though
they are technically larger than a pointer on those platforms.
-``-funbox-strict-fields``
+.. ghc-flag:: -funbox-strict-fields
+
.. index::
- single: -funbox-strict-fields
single: strict constructor fields
single: constructor fields, strict
This option causes all constructor fields which are marked strict
- (i.e. “!”) to be unpacked if possible. It is equivalent to adding an
+ (i.e. ``!``) to be unpacked if possible. It is equivalent to adding an
``UNPACK`` pragma to every strict constructor field (see
:ref:`unpack-pragma`).
@@ -690,75 +631,89 @@ list.
it for certain constructor fields using the ``NOUNPACK`` pragma (see
:ref:`nounpack-pragma`).
-``-funfolding-creation-threshold=n``
+.. ghc-flag:: -funfolding-creation-threshold=<n>
+
+ :default: 750
+
.. index::
- single: -funfolding-creation-threshold
single: inlining, controlling
single: unfolding, controlling
- *default: 750.* Governs the maximum size that GHC will allow a
+ Governs the maximum size that GHC will allow a
function unfolding to be. (An unfolding has a “size” that reflects
the cost in terms of “code bloat” of expanding (aka inlining) that
unfolding at a call site. A bigger function would be assigned a
bigger cost.)
- Consequences: (a) nothing larger than this will be inlined (unless
- it has an INLINE pragma); (b) nothing larger than this will be
- spewed into an interface file.
+ Consequences:
+
+ a. nothing larger than this will be inlined (unless it has an ``INLINE`` pragma)
+ b. nothing larger than this will be spewed into an interface file.
Increasing this figure is more likely to result in longer compile
- times than faster code. The ``-funfolding-use-threshold`` is more
+ times than faster code. The :ghc-flag:`-funfolding-use-threshold` is more
useful.
-``-funfolding-dict-discount=n``
+.. ghc-flag:: -funfolding-dict-discount=<n>
+
+ :default: 30
+
.. index::
- single: -funfolding-dict-discount
single: inlining, controlling
single: unfolding, controlling
- Default: 30
+ How eager should the compiler be to inline dictionaries?
+
+.. ghc-flag:: -funfolding-fun-discount=<n>
+
+ :default: 60
-``-funfolding-fun-discount=n``
.. index::
- single: -funfolding-fun-discount
single: inlining, controlling
single: unfolding, controlling
- Default: 60
+ How eager should the compiler be to inline functions?
+
+.. ghc-flag:: -funfolding-keeness-factor=<n>
+
+ :default: 1.5
-``-funfolding-keeness-factor=n``
.. index::
- single: -funfolding-keeness-factor
single: inlining, controlling
single: unfolding, controlling
- Default: 1.5
+ How eager should the compiler be to inline functions?
+
+.. ghc-flag:: -funfolding-use-threshold=<n>
+
+ :default: 60
-``-funfolding-use-threshold=n``
.. index::
- single: -funfolding-use-threshold
single: inlining, controlling
single: unfolding, controlling
- *default: 60.* This is the magic cut-off figure for unfolding (aka
+ This is the magic cut-off figure for unfolding (aka
inlining): below this size, a function definition will be unfolded
at the call-site, any bigger and it won't. The size computed for a
function depends on two things: the actual size of the expression
minus any discounts that apply depending on the context into which
the expression is to be inlined.
- The difference between this and ``-funfolding-creation-threshold``
+ The difference between this and :ghc-flag:`-funfolding-creation-threshold`
is that this one determines if a function definition will be inlined
*at a call site*. The other option determines if a function
definition will be kept around at all for potential inlining.
-``-fvectorisation-avoidance``
+.. ghc-flag:: -fvectorisation-avoidance
+
+ :default: on
+
.. index::
single: -fvectorisation-avoidance
Part of :ref:`Data Parallel Haskell (DPH) <dph>`.
- *On by default.* Enable the *vectorisation* avoidance optimisation.
+ Enable the *vectorisation* avoidance optimisation.
This optimisation only works when used in combination with the
``-fvectorise`` transformation.
@@ -767,13 +722,13 @@ list.
modifies the vectorisation transformation to try to determine if a
function would be better of unvectorised and if so, do just that.
-``-fvectorise``
- .. index::
- single: -fvectorise
+.. ghc-flag:: -fvectorise
+
+ :default: off
Part of :ref:`Data Parallel Haskell (DPH) <dph>`.
- *Off by default.* Enable the *vectorisation* optimisation
+ Enable the *vectorisation* optimisation
transformation. This optimisation transforms the nested data
parallelism code of programs using DPH into flat data parallelism.
Flat data parallel programs should have better load balancing,