Compile time vs run time -- what is the difference?

Ali Çehreli acehreli at yahoo.com
Wed Dec 28 16:04:58 UTC 2022


On 12/27/22 18:31, thebluepandabear wrote:

 > What I do understand is that compile time and run time are the two
 > processes that your code goes through to be executed natively.

There is a confusion: Compile time ends when the compiler generates the 
executable program, one that will be executed natively.

Run time is each time when the user starts the executable program by 
typing its name followed by the Enter key, double clicking on it, etc.

For a program that was extremely simple, bug-free, lucky, etc. there may 
be as few as a single compilation and infinite number of executions (run 
times).

On the other hand, for a program that could never be compiled 
successfully, there may be infinite number of compilations and zero run 
times.

 > In Java and some other languages, during compile time the code gets
 > executed into Java bytecode. This also happens for C#. I don't know if
 > there is an equivalent 'intermediate' language for D that your code gets
 > translated to.

No, D does not use that model.

Copying a comment of yours:

 > Before even running the code I get an IDE warning
 > (IntelliJ). Does IntelliJ compile the code in the background?

Yes, many IDEs continuously compile the code as you type the source code 
to understand it to give you such help. I don't think any of them can 
run the program though because the program can be in a state that could 
harm its environment like deleting unwanted files.

Ali



More information about the Digitalmars-d-learn mailing list