Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Compile time

From Wikipedia, the free encyclopedia
Time when a program is compiled
icon
This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Compile time" – news ·newspapers ·books ·scholar ·JSTOR
(January 2023) (Learn how and when to remove this message)
Program execution
General concepts
Types of code
Compilation strategies
Notable runtimes
Notable compilers & toolchains

Incomputer science,compile time (orcompile-time) describes the time window during which a language's statements are converted intobinary 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 (run time).

For example,compile-time requirements areprogramming language requirements that must be met bysource code before compilation andcompile-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 ascompilation time.

Overview

[edit]

Most compilers have at least the following compiler phases (which therefore occur at compile-time):syntax analysis,semantic analysis, andcode generation. During optimization phases, constant expressions in the source code can also be evaluated at compile-time usingcompile-time execution, which reduces the constant expressions to an immediate, single value.[2][3] This is not necessary for correctness, but to improve 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 includerange-checks (e.g., proving that an array index will not exceed the array bounds),deadlock freedom inconcurrent languages, or timings (e.g., proving that a sequence of code takes no more than an allocated amount of time). For statically-typed languages such asJava orRust, types are checked at compile time to ensuretype safety.[4]

Compile-time occurs beforelink time (when the output of one or more compiled files are joined) andruntime (when aprogram isexecuted). However, in the case ofdynamic compilation, the final transformations intomachine language happen at run time. Some compile-time operations can also be deferred to link-time while still not incurring a run-time cost.

See also

[edit]

References

[edit]
  1. ^"A History of Computer Programming Languages". Retrieved2022-12-25.
  2. ^Yongwei, Wu (October 7, 2024)."C++ Compile-Time Programming".accu.org. Retrieved2025-04-26.
  3. ^"Compile Time Evaluation".C3. Retrieved2025-04-26.
  4. ^"Data Types - The Rust Programming Language".doc.rust-lang.org. Retrieved2025-04-26.
Stub icon

Thiscomputer science article is astub. You can help Wikipedia byexpanding it.

Retrieved from "https://en.wikipedia.org/w/index.php?title=Compile_time&oldid=1321833325"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp