Optimize
Optimize options
There are five compiler options for optimization:
-O0
, -O
, -Os
, -O2
, -O3
.
These options enable optimization at both translation
(from COBOL to C) and compilation (C to assembly) levels.
Currently, there is no difference between these optimization options at
the translation level other than -O0
disabling constant folding of
expressions and disabling removement of unreachable code.
The option -O
, -Os
or -O2
is passed to the
C compiler as is and used for C level optimization.
Additional the options -fremove-unreachable
and -fconstant-folding
may be used to adjust handling of these parts; note that constant-folding is a dialect
specific option and that both options have an effect on the detail of checks done
to unreachable code.
Optimize call
When a CALL
statement is executed, the called program is linked at run
time. By specifying the compiler option -fstatic-call
, you can
statically link the program at compile time and call it efficiently.
( Static linking)
Optimize binary
By default, data items of usage binary or comp are stored in big-endian form. On those machines whose native byte order is little-endian, this is not quite efficient.
If you prefer, you can store binary items in the native form of your
machine. Set the config option binary-byteorder
to
native
in your config file ( Customize).
In addition, setting the option binary-size
to 2-4-8
or
1-2-4-8
is more efficient than others.