Why Julia?

Julia is an is a general-purpose, open-source, dynamic, and high-performance language. By leveraging a clever design around a just in time (JIT) compiler, Julia manages to combine the speed of languages like C or Fortran, with the ease of use of Matlab or Python.

Some Features of Julia

Julia has many interesting features, but here is a small sample of what I think is most basic characteristics that make Julia attractive for Science and Engineering.

  • JIT Compiled. Write code that looks interpreted, and yet it gets to run as just as fast as compiled code. No need to vectorize code for performance, devectorized code is fast.
  • Optionally Typed. Do some rapid prototyping with maximum flexibility, and then optimize for performance.
  • Nice Mathematical Syntax. Builds upon and goes much further than classical mathematical languages like Fortran, Matlab, and Mathematica.
  • General purpose. Get code from the package manager to perform all sort of tasks, from reading multiple types of databases, to data visualization, or running an HTTP server.

Is Julia Really as Fast as Advertised?

Coming from a compiled-language background, I have to acknowledge that I was skeptical about this at first. So I set out to write my own benchmark, suited for my personal use case. As it turns out, I found out that after some tweaking of both the compiled code and the Julia code, that indeed Julia can be just as fast as highly-optimized Fortran code. And it can do so with 3 times less lines of code.

You can read my post about this benchmark here. The benchmark has two parts: considering some basic out-of-the-box implementation and see which is faster, and then going for highly-optimized codes and evaluate how much effort we needed to create such codes.

Long story short, my conclusion is that not only the trade-off between programmer effort and code efficiency is what makes Julia shine, but the fact that we can get serious about optimizing the speed of our codes, and make Julia really high-performance, for a fraction of the effort we would need in older compiled languages such as C or Fortran.

Is the Julia Language Free?

The Julia language was originally developed by a group of researchers at MIT, and released as open-source and under a permissive license. Julia also has a thriving open-source community responsible for the creation of thousands of packages. As such, most of Julia is and will remain free to use.

Eventually, some of the Julia founding members formed JuliaComputing, a venture backed company, to continue the development of the Julia language. The business model of JuliaComputing is offering paid support and consultancy, commercial Julia packages (like a Bloomberg API for financial modelling, or a software suite for pharmaceutical companies), and cloud computing services.

How to learn Julia

This is hands-on tutorial series, which focuses on understanding the most important aspects of the language from a practical point of view, and focusing on the needs of scientists and engineers.

In particular, we won’t be introducing much more syntax or language features than what is required to solve the different problems we will be tackling.

As a quick reference, and if you have experience with Python or Matlab, it might be worth to check out the Matlab-Python-Julia Cheatsheet.

For a thorough explanation of the Julia language, you can always check out the Full Documentation.

Where to find help?

Julia is still a relatively new language, so you might not find as much information online as in other languages. For this reason, if you can’t find some answers online, don’t hesitate to address the Julia Forum, where people are very friendly and welcoming.

Installing Everything

You can download the latest stable release of Julia here, which, last time I tested this tutorial, was version 1.6.1. Bear in mind that if you install Julia from certain package distribution systems (like APT) you might get a previous version.

In this tutorial series we are mostly going to be working with the VSCode IDE for Julia, which you can get here.

Make sure to also get the Julia Extension for VSCode.

Installing packages

One of the salient characteristics of Julia is its excellent package distribution system, and the open-source community built around it.

Packages can be easily installed from the REPL. Let’s install, for example, the Linear Algebra package. Simply do:

import Pkg; Pkg.add("LinearAlgebra")

For using the packages in our projects, we need to include them with a using statement:

using LinearAlgebra

Searching packages online

Besides from searching Google or asking in the Forums for Julia packages, there are two very useful official resources that keep track and can help you find packages:

Conclusion

Do you want to give Julia a try? Are you already programming in Julia and want to read along? This is a growing series of tutorial posts, so stay tuned for additional material!