20 ms·
What makes Julia so fast?
by frr149 5y ago
What makes Julia so fast?
- eigenspace 5y agoBeing designed to be fast. Lots of other high level languages were designed with the assumption that performance critical code would be written in low-level languages so they didn't bother designing the language to make various optimzations possible. Julia was designed for people who don't want to use a low level language for speed. It took a lot of great ideas from languages like Common Lisp, Fortran, etc. as well as a few good ideas of its own and packaged them together in a rather novel way. The language is dynamic, but it's dynamism is limited in specific ways that makes it very easy for the compiler to optimize code.
- jakobnissen 5y agoFunctions compile just-ahead-of-time to native code using LLVM. Functions specialize based on the input types used and use type inference, meaning that in idiomatic Julia code, all types are known at compile time. Finally, Julia uses struct layout similar to static languages like C or Rust. The trifecta of complete type information, compilation to native code, and efficient data layout, is what makes the difference. Notably, Julia is not any faster than most static languages, nearly all of whom also use the same trio.