What’s the difference between "Compile time" and "run time"?

Asked

Viewed 1,336 times

19

Compile time and run time are common terms that we often hear in the programming area, what are the main differences or characteristics of these two terms?

  • 1

    This answer deals with it superficially: https://answall.com/a/197854/64969

  • Basically, Compile time refers to events that occur during compilation (e.g., syntax errors) while run time are events that occur when the application is running (e.g., nullpointerexception).

2 answers

20


The Compile time or compile time is all that occurs during the compile process, all that can be detected, generated, optimized, performed when the code is being compiled. In general it is where one takes syntactic, lexical and semantic errors, typing or even, together with other tools, validate with unit test or other analyses called static.

Already run time or runtime is all that happens when the code is already running, so if there is a problem it may be too late to solve. On the other hand it may be that only at that moment with the right data it is possible to understand what happens, what can be optimized, etc. Errors dependent on the data to be processed usually paralyze the execution if there is no mechanism to deal with it. In general direct or indirect data entries will determine what will occur.

For robustness and better performance we usually say that it is better to solve everything that gives compilation time, and it is one of the reasons that the interpreted languages are considered "inferior" since they usually only have the runtime. But there are cases that just leave for execution time is the only or best way out.

The term link time can also be used to the can be solved in time linkediting, but is more rare.

Some languages have the link time dynamic, that is, just before the runtime, and not just after the compilation. Some do so structured and complex with a specific mechanism that we use the term JIT time.

There is still the time design, which has a slightly different context. It refers to the moment the code is being created, that is, it is before the compilation and may be aided by some tool.

Finally, the term Development time can still be used for the entire development cycle as opposed to the production cycle.

5

Compile Time - Compilation time:

During compilation, obvious code problems are detected as syntax errors.

Run Time - Running time:

Errors may also occur during execution. These may be caused by inappropriate inputs that have not undergone any treatment or other occurrence that could not have been detected as an error by the compiler. Examples: The program waits for a number and a letter is typed, or the program tries to use a variable that has not started and gives a Nullpointerexception, etc.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.