WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center

CompilationOptions

is an option for Compile that specifies settings for the compilation process.

Details
Details and Options Details and Options
Examples  
Basic Examples  
Options  
ExpressionOptimization  
InlineCompiledFunctions  
InlineExternalDefinitions  
See Also
Tech Notes
History
Cite this Page

CompilationOptions

is an option for Compile that specifies settings for the compilation process.

Details

  • CompilationOptions applies to the creation of the compiled function.
  • CompilationOptions accepts lists of settings in the form CompilationOptions->{}.
  • CompilationOptions can also take the following nested settings:
  • "ExpressionOptimization" Automatic whether to optimize the input expression
    "InlineCompiledFunctions" Automatic whether to expand the body of nested compiled functions
    "InlineExternalDefinitions" Automatic whether to use external definitions
  • Possible values for "ExpressionOptimization" are:
  • False do not optimize the input expression
    True optimize the input expression
    Automatic only use the optimized expression if the compiled function does not make external calls
  • Possible values for "InlineCompiledFunctions" are:
  • False do not inline nested compiled functions
    True inline nested compiled functions
    Automatic inline small nested compiled functions
  • Possible values for "InlineExternalDefinitions" are:
  • False do not use external definitions
    True insert the body of external definitions
    Automatic use the type of external definitions

Examples

open all close all

Basic Examples  (1)

Options to control how the compilation runs can be given in a nested form. For example, you can turn off compilation optimizations. This may cause the same computation to be done more than once:

Options  (3)

ExpressionOptimization  (1)

The default setting of Automatic optimizes the input expression to avoid computing the same subpart more than once:

If the compiled function needs to make an external call to the Wolfram Language, the default setting of Automatic does not optimize:

Turning off compilation optimizations may cause the same computation to be done more than once:

Setting "CompileOptimizations" to True causes optimization even if the compiled function needs to make an external call to the Wolfram Language:

InlineCompiledFunctions  (1)

The default setting of Automatic inlines nested compiled functions if they are small:

A setting of False will avoid inlining the compiled function:

InlineExternalDefinitions  (1)

The default setting of Automatic uses the type of external definitions, but makes an external call. In this case the external call fails:

A setting of True will inline the external definition, allowing the computation to proceed without errors:

A setting of False will not inline the external definition and will not use the type information. In this case there is an external call that fails:

Wolfram Research (2010), CompilationOptions, Wolfram Language function, https://reference.wolfram.com/language/ref/CompilationOptions.html.

Text

Wolfram Research (2010), CompilationOptions, Wolfram Language function, https://reference.wolfram.com/language/ref/CompilationOptions.html.

CMS

Wolfram Language. 2010. "CompilationOptions." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CompilationOptions.html.

APA

Wolfram Language. (2010). CompilationOptions. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CompilationOptions.html

BibTeX

@misc{reference.wolfram_2025_compilationoptions, author="Wolfram Research", title="{CompilationOptions}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/CompilationOptions.html}", note=[Accessed: 05-December-2025]}

BibLaTeX

@online{reference.wolfram_2025_compilationoptions, organization={Wolfram Research}, title={CompilationOptions}, year={2010}, url={https://reference.wolfram.com/language/ref/CompilationOptions.html}, note=[Accessed: 05-December-2025]}

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /