I would like to make a high-level summary about compile-time vs run-time , based on the end part of this too long thread , that I think will help other (beginner) users too,
and also ask a question.
While in Julia, due to JIT technology, the compile- vs run- time steps are not explicitly called by user, they manifest themselves in duration of first call vs subsequent calls of a function.
Let’s consider the definition of a function in Julia, and it’s call.
- Compile-time is all the analysis, transformations, computations, optimizations and translation till machine language code, that the function’s code is subject to, the first time that function is “called” (during a program/module execution, or during a REPL session) (hence “Just-In-Time” tech. name)
- Run-time (“execution” time) is the period of execution of the binary code resulting from compilation. Run-time happens after compilation in a first-time function call, or by itself in subsequent calls (during a program/module execution, or during a REPL session)
For more introductory details, see this discourse reply.
By sem-actions (semantic actions) I will mean all the semantic-level action steps (operations/function calls/assignments/definitions…) that must be taken by the computer, as expressed in a piece of source code.
Some of sem-actions in a program require/involve :
- (reading) external inputs (like user-supplied arguments to a program; interactive user-inputs; reading a HD file, …),
- others involve (writing) external outputs (like writing to terminal or an external file).
I guess in a word they are called “I/O operations”
The question: Is the following a good rule of thumb?
Any sem-actions that do not involve/require external inputs or outputs are taken at compile-time, while those that do require them – at run-time.
I was inspired by the following:
Comment: I think that is a good ideal (or principle) that further compilation technology development will strive to achieve (if currently is not yet fully achieved)
(Let me know if should be in another posting category)