Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between "compile time" and "run time"?

I do not understand what is meant by the terms "compile time" and "run time" (or "runtime").

I'm also a bit confused about what "value type" and "reference type" mean, and how they relate to the 'times mentioned above.

Would someone please explain these things?

like image 545
Surya sasidhar Avatar asked Oct 05 '09 10:10

Surya sasidhar


People also ask

What is the difference between runtime and compile time?

Compile time is the period when the programming code (such as C#, Java, C, Python) is converted to the machine code (i.e. binary code). Runtime is the period of time when a program is running and generally occurs after compile time.

What is compile time and runtime in C++?

A compile-time constant is a value that is computed at the compilation-time. Whereas, A runtime constant is a value that is computed only at the time when the program is running. 2. A compile-time constant will have the same value each time when the source code is run.

What is called compile time?

In computer science, compile time (or compile-time) describes the time window during which a computer program is compiled. 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).


2 Answers

"Compile time" is when you build your code - when the compiler converts your source code into IL.

"Runtime" is when your code is executed - for ASP.NET, when a page request is made. (Personally I prefer the term "execution time" to distinguish between that and "the Common Language Runtime (CLR)" - aka the virtual machine.)

Value types and reference types are an entirely separate concept, but I have an article about them which you may find useful.

like image 169
Jon Skeet Avatar answered Oct 05 '22 05:10

Jon Skeet


A variable that is a value type, stores the data, while a variable of a reference type stores a reference to the data.

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 at compile time.

The operations performed at compile time usually include syntax analysis, various kinds of semantic analysis (e.g., type checks and instantiation of template) and code generation.

In computer science, the qualifier run time, run-time, runtime, or execution time refers to the period while a computer program is actually executed ("run") in a computer, from beginning to termination. It may also mean the program's running time, the duration of that period.

like image 28
rahul Avatar answered Oct 05 '22 06:10

rahul