Compile time: Difference between revisions
CannedCans (talk | contribs) Adding short description: "The time during which source code is validated and converted to machine code by a compiler" (Shortdesc helper) |
Bobby Cohn (talk | contribs) m correcting link after RM |
||
(14 intermediate revisions by 12 users not shown) | |||
Line 1: | Line 1: | ||
{{Short description|The time during which source code is validated and converted to machine code by a compiler}} |
{{Short description|The time during which source code is validated and converted to machine code by a compiler}} |
||
{{ |
{{more citations needed|date=January 2023}} |
||
{{Program execution}} |
{{Program execution}} |
||
In [[computer science]], '''compile time''' (or '''compile-time''') describes the time window during which a language's statements are converted into [[Machine code|binary instructions]] for the processor to execute.<ref>{{Cite web|title=A History of Computer Programming Languages |
|||
In [[computer science]], '''compile time''' refers to either the operations performed by a [[compiler]] (the "compile-time operations"), [[programming language]] requirements that must be met by [[source code]] for it to be successfully compiled (the "compile-time requirements"), or properties of the program that can be reasoned about during compilation. Compile time refers to the time duration in which the programming code is converted to the machine code (i.e binary code) and usually occurs before [[Run time (program lifecycle phase)|runtime]]. |
|||
|url=https://cs.brown.edu/~adf/programming_languages.html|language=en|access-date=2022-12-25}}</ref> |
|||
The term is used as an adjective to describe concepts related to the context of program compilation, as opposed to concepts related to the context of program execution ([[Run time (program lifecycle phase)|runtime]]). |
|||
For example, ''compile-time requirements'' are [[programming language]] requirements that must be met by [[source code]] before compilation and ''compile-time properties'' are properties of the program that can be reasoned about during compilation. |
|||
The actual length of time it takes to compile a program is usually referred to as ''compilation time''. |
|||
== Compile time/Early binding vs Run time == |
== Compile time/Early binding vs Run time == |
||
The determination of execution model have been set during the compile time stage. |
The determination of execution model have been set during the compile time stage. |
||
Run time- the method of execution and allocation - have been set during the run time and are based on the run time dynamicity. |
|||
==Overview== |
==Overview== |
||
Most compilers have at least the following compiler phases (which therefore occur at compile-time): [[syntax analysis]], [[semantic analysis (computer science)|semantic analysis]], and [[code generation (compiler)|code generation]]. |
|||
During optimization phases, constant expressions in the source code can also be evaluated at compile-time using [[compile-time function execution|''compile-time execution'']], which reduces the constant expressions to a single value. |
|||
This is not necessary for correctness, but improves program performance during runtime. |
|||
Programming language definitions usually specify compile time requirements that source code must meet to be successfully compiled. |
Programming language definitions usually specify compile time requirements that source code must meet to be successfully compiled. |
||
For example, languages may stipulate that the amount of storage required by types and variables can be deduced. |
|||
Properties of a program that can be reasoned about at compile time include [[range check|range-check]]s (e.g., proving that an array index will not exceed the array bounds), deadlock freedom in concurrent |
Properties of a program that can be reasoned about at compile time include [[range check|range-check]]s (e.g., proving that an array index will not exceed the array bounds), [[deadlock (computer science)|deadlock]] freedom in [[concurrent language]]s, or timings (e.g., proving that a sequence of code takes no more than an allocated amount of time). |
||
Compile |
Compile-time occurs before [[link time]] (when the output of one or more compiled files are joined) and [[Run time (program lifecycle phase)|runtime]] (when a [[computer program|program]] is [[Execution (computing)|executed]]). |
||
Although in the case of [[dynamic compilation]], the final transformations into [[machine language]] happen at runtime. |
|||
There is a trade-off between compile-time and link-time in that many compile time operations can be deferred to link-time without incurring run-time cost. |
|||
"Compile time" can also refer to the amount of time required for compilation. |
|||
==See also== |
==See also== |
||
Line 26: | Line 33: | ||
*[[Compiling]] |
*[[Compiling]] |
||
*[[Type system]] |
*[[Type system]] |
||
*[[ |
*[[Dynamic compilation]] |
||
* [[Just-in-time compilation|Just in time compilation]] |
|||
==References== |
|||
{{reflist}} |
|||
{{DEFAULTSORT:Compile Time}} |
{{DEFAULTSORT:Compile Time}} |
||
[[Category:Compiler construction]] |
[[Category:Compiler construction]] |
||
{{Comp-sci-stub}} |
{{Comp-sci-stub}} |
Latest revision as of 19:04, 20 August 2024
This article needs additional citations for verification. (January 2023) |
Program execution |
---|
General concepts |
Types of code |
Compilation strategies |
Notable runtimes |
|
Notable compilers & toolchains |
|
In computer science, compile time (or compile-time) describes the time window during which a language's statements are converted into binary instructions for the processor to execute.[1] The term is used as an adjective to describe concepts related to the context of program compilation, as opposed to concepts related to the context of program execution (runtime). For example, compile-time requirements are programming language requirements that must be met by source code before compilation and compile-time properties are properties of the program that can be reasoned about during compilation. The actual length of time it takes to compile a program is usually referred to as compilation time.
Compile time/Early binding vs Run time
[edit]The determination of execution model have been set during the compile time stage. Run time- the method of execution and allocation - have been set during the run time and are based on the run time dynamicity.
Overview
[edit]Most compilers have at least the following compiler phases (which therefore occur at compile-time): syntax analysis, semantic analysis, and code generation. During optimization phases, constant expressions in the source code can also be evaluated at compile-time using compile-time execution, which reduces the constant expressions to a single value. This is not necessary for correctness, but improves program performance during runtime.
Programming language definitions usually specify compile time requirements that source code must meet to be successfully compiled. For example, languages may stipulate that the amount of storage required by types and variables can be deduced.
Properties of a program that can be reasoned about at compile time include range-checks (e.g., proving that an array index will not exceed the array bounds), deadlock freedom in concurrent languages, or timings (e.g., proving that a sequence of code takes no more than an allocated amount of time).
Compile-time occurs before link time (when the output of one or more compiled files are joined) and runtime (when a program is executed). Although in the case of dynamic compilation, the final transformations into machine language happen at runtime.
There is a trade-off between compile-time and link-time in that many compile time operations can be deferred to link-time without incurring run-time cost.
See also
[edit]- Link time
- Run time (program lifecycle phase)
- Compiling
- Type system
- Dynamic compilation
- Just in time compilation
References
[edit]- ^ "A History of Computer Programming Languages". Retrieved 2022-12-25.