Skip to content

Commit 09d0b4b

Browse files
author
Colin Robertson
committed
More explanation of link time effects.
1 parent 02c863c commit 09d0b4b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docs/build/reference/opt-optimizations.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,16 @@ By default, the **/OPT:LBR** option is set when incremental linking is not enabl
5555

5656
## Remarks
5757

58-
The **/OPT** optimizations generally decrease the image size and increase the program speed at a cost of increased link time.
58+
When used at the command line, the linker defaults to **/OPT:REF,ICF,LBR**. If **/DEBUG** is specified, the default is **/OPT:NOREF,NOICR,NOLBR**.
59+
60+
The **/OPT** optimizations generally decrease the image size and increase the program speed. These improvements can be substantial in larger programs, which is why they are enabled by default for retail builds.
61+
62+
Linker optimization does take extra time up front, but the optimized code also saves time when the linker has fewer relocations to fix up and creates a smaller final image, and it saves even more time when it has less debug information to process and write into the PDB. When optimization is enabled, it can result in a faster link time overall, as the small additional cost in analysis may be more than offset by the time savings in linker passes over smaller binaries.
5963

6064
The **/OPT** arguments may be specified together, separated by commas. For example, instead of **/OPT:REF /OPT:NOICF**, you can specify **/OPT:REF,NOICF**.
6165

6266
You can use the [/VERBOSE](../../build/reference/verbose-print-progress-messages.md) linker option to see the functions that are removed by **/OPT:REF** and the functions that are folded by **/OPT:ICF**.
6367

64-
When used at the command line, the linker defaults to **/OPT:REF,ICF,LBR**. If **/DEBUG** is specified, the default is **/OPT:NOREF,NOICR,NOLBR**.
65-
6668
The **/OPT** arguments are often set for projects created by using the **New Project** dialog in the Visual Studio IDE, and usually have different values for debug and release configurations. If no value is set for these linker options in your project, then you may get the project defaults, which can be different from the default values used by the linker at the command line.
6769

6870
### To set the OPT:ICF or OPT:REF linker option in the Visual Studio development environment

0 commit comments

Comments
 (0)