Visual Basic Compiler Options  

/optimize

Enables or disables compiler optimizations.

/optimize[ + | - ]

Arguments

+ | -
/optimize+, which is the same as /optimize and is the default for this option, enables compiler optimizations. /optimize- disables optimizations.

Remarks

Compiler optimizations make your output file smaller, faster, and more efficient. However, because optimizations result in code rearrangement in the output file, /optimize+ can make debugging difficult.

All references (see /reference) in an assembly must have the same optimization settings.

To prevent an optimized output file, specify /optimize-.

You can combine the /optimize and /debug options.

To set /baseaddress in the Visual Studio integrated development environment

  1. Open the project's Property Pages dialog box. For details, see <Projectname> Property Pages Dialog Box.
  2. Click the Configuration Properties folder.
  3. Click the Optimizations property page.
  4. Modify the Enable optimizations property.

To set /optimize programmatically

Example

The following code compiles t2.vb and enables compiler optimizations:

vbc t2.vb /optimize

See Also

Visual Basic Compiler Options | /debug | Sample Compilation Command Lines