is an option for Compile that specifies settings for the compilation process.
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 expressionTrue optimize the input expressionAutomatic 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 functionsTrue inline nested compiled functionsAutomatic inline small nested compiled functions
- Possible values for "InlineExternalDefinitions" are:
-
False do not use external definitionsTrue insert the body of external definitionsAutomatic use the type of external definitions
Examples
open all close allBasic 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)
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:
History
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]}