4 ms·
julia is interpreted -- it's type system enables the speedups often presented in benchmarks.
by genomez4fun 6y ago
julia is interpreted -- it's type system enables the speedups often presented in benchmarks.
- elcomet 6y agoIt's a bit more complex. Both python and julia are compiled to bytecode. Then python bytecode gets interpreted, but I think that julia bytecode is actually compiled with a JIT compiler. So julia is not really interpreted.
- st1x7 6y agoCan you explain the difference between the two at a beginner level? (the two sound kind of the same)
- Sukera 6y agoPython is "compiled" to python bytecode, which is interpreted by the python runtime (as in, the python runtime looks up what a function should do, does that thing, then checks the next piece of code). Julia is compiled to first julia-IR, then LLVM IR and finally raw machine code (assembly, x86, those things) which is just run like any other compiled language. It's not interpreted.
- johnmyleswhite 6y agoWhat do you mean when you use the word "bytecode" in reference to Julia?
- elcomet 6y agoI'm not very familiar with julia so it might be wrong. It might be just an AST. The point is that julia is JIT compiled.
- ddragon 6y agoJulia has multi-stage compilation: first it's lowered to the AST (all macros are resolved), then it is lowered to an IR, then types are solved, then it's lowered to an SSA form IR, then to LLVM IR and finally machine code [1] (and it's JIT will try to pre-compile as much code as it can, in some situations it might even compile the entire program in one go, which is the cause of the delay when starting the program). Everything that runs is always machine code as there is no interpreter or VM (though you might say that Julia's bytecode is the LLVM IR). [1] https://blog.rogerluo.me/images/julia-compile-diagram.png https://blog.rogerluo.me/images/julia-compile-diagram.png
- Sukera 6y agoThat's not true, julia is compiled down to assembly like any regular C program would. It's just going through LLVM and most code is compiled interactively when you use the REPL, which is why you might think it's interpreted.