Posted in: Coding

Julia versus Python

“Even the smallest person can change the course of the future”- Galadriel (From Lord Of The Rings)

Data Science was rated as the sexiest job of the 21st century back in 2012 by Harvard Business Review [1]. Rightly so, every company in its own might is leveraging data to make data-driven actionable insights. There are a lot of tools that are employed for these purposes. To name a few, we have SQL, Python, R, Julia, Java, Scala, MATLAB among many other scripting and querying languages. Each of them is used in varying degrees across different companies. The below figure shows the popularities of various tools [2]. Python still remains the most popular tool for data science.

Comparision of data science tools. Source: 2020 Kaggle Data Science and Machine Learning Survey

In this article, I hope to throw some light on one of the “newest” languages in the block-Julia. At the onset of 2009, Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and Alan Edelman set out to create a high-level, highly functional, dynamic programming language. Their main focus was creating an easy-to-use language, a very high-performance language for numerical analysis and scientific computing purposes.

Numerical analysis and scientific computing traditionally work well in high-performance paradigms, however, people have been using slower dynamic languages for daily work. Julia’s compiler is different from the interpreters used by Python, and R which makes it much faster. The other features under Julia’s purview are optional typing, multiple dispatch with the aid of type inference, and just-in-time compilation [3]. The advantage of Julia is in its simplicity in that, it is a high-level programming language that supports functional, object-oriented programming but at the same time is very strong for scientific computing and numerical analysis as it is very similar to MATLAB in that sense.

As a simple experiment, I ran a simple experiment to compare to benchmark Julia’s performance against Python. The experiment involved defining the same Feed Forward Neural Network architecture in Julia and Python using Flux and Keras deep learning frameworks respectively [4]. The experiment was on CPU run MacBook Pro (Retina, 15-inch, Mid 2014) edition.

The time taken on Julia was 133 seconds [5]

Julia’s computation on training performance for Fashion MNIST data

While for Python it was around 237 seconds [6].

Python performance on training for Fashion MNIST data

The above was just an experiment that clearly showed that Julia outperformed Python’s performance in terms of execution. And on GPU, the differences in speed execution would be much better. [5], and [6] also show that the general structure of programming in Julia and Python largely remains the same. However, Julia’s community is still small and unlike Python, beginners may find some issues in getting help when compared to Python’s wide spread community.

To sum it up, Julia is an upcoming language that still has to find its rightful place in the data science world. There are a lot of positives offered by Julia but much work still needs to be done in order to catch up with Python and others. But with companies like Amazon, Apple, Disney, Facebook, Ford, Google, Grindr, IBM, Microsoft, NASA, Oracle, and Uber using Julia [7], it is only a matter of time Julia will gain its rightful place in the data science community. On similar lines said by Galadriel from Lord of the Rings, nascent language like Julia could bring about a huge change in the paradigm, all it needs is a change in momentum. I would strongly urge the reader to give Julia a try and I promise you won’t look back!

Extras

Some links that would help you to direclty deep dive into Julia

https://julialang.org/downloads/

https://docs.julialang.org/en/v1/manual/getting-started/

https://juliaacademy.com/courses

References

[1] https://hbr.org/2012/10/data-scientist-the-sexiest-job-of-the-21st-century

[2] https://research.aimultiple.com/data-science-tools/

[3] https://docs.julialang.org/en/v1/

[4] https://github.com/ashvinsrini/Julia_Vs_Python

[5] https://github.com/ashvinsrini/Julia_Vs_Python/blob/master/Julia_FFNN.ipynb

[6] https://github.com/ashvinsrini/Julia_Vs_Python/blob/master/Python_FFNN.ipynb

[7] https://www.forbes.com/sites/suparnadutt/2017/09/20/this-startup-created-a-new-programming-language-now-used-by-the-worlds-biggest-companies/?sh=510a73757de2