Designed and developed by Graydon Hoare at Mozilla Research, the Rust programming language arrived on the scene in 2010. The multi-paradigm programming language has become one of the most favoured languages in the last few years.
As per O’Reilly’s annual ranking, Rust grew 94 percent over the past year. Further, the annual Stack Overflow Developer Survey has picked Rust as the ‘most loved’ language for five consecutive years now.
Rust blends the performance of languages such as C++, adds a friendlier syntax, with a higher focus on code safety and simplifies the development process. Notably, a few portions of the Mozilla Firefox browser are written in Rust. Microsoft is also turning to it for recoding the parts of Windows operating systems.
Sign up for your weekly dose of what's up in emerging technology.
Let’s examine what makes Rust so irresistible:
- R, Python, Matlab are the common languages used for data analysis. However, since these languages interpret the code line-by-line, the speed factor is compromised. While C and C++ offer an advantage in this aspect, they have no ‘guide rails’. Meaning, there are no controls to stop them from inappropriately accessing memory sent back to the OS or from releasing the same piece twice. This can result in meaningless data, or in the worst case, expose security issues or cause the program to crash. Rust successfully overcomes this problem.
- Rust has a strong memory management system. It assigns each piece of memory to a single owner and determines who can access it. It also ensures parallelized code, enabling software to run safely on multiple processors. Rust is easier to maintain and debug.
- Unlike languages such as C, Rust has a single tool Cargo to compile, run, download libraries, auto-generate documentation, among other things. Rust works well with intricate codes when the project consists of multiple crates. It comes with a plug-in, Clippy, to catch common mistakes on the go, and further improve the code.
- Dynamic vs static typing is a bone of contention when it comes to programming languages. It is easier to produce software with dynamic typing, as in Python, but it may also lead to unmaintainable code. Rust takes the middle path. It is a static type system that requires the programmer to specify parameters such as function arguments and constants. Inside the function body, however, inference, as observed in case of dynamic typing, is allowed.
Is It Good Enough?
Rust is a relatively new entrant. Hence, the language has a significantly lesser number of libraries than Python. Lack of machine learning-specific libraries also means that a lot of codebases have to be written from scratch. For a user without a background in low-level programming, using Rust is a challenge. The community support, though vibrant, lacks in volume.
That said, Rust is a good fit to build an efficient and reliable data science backend. The language can be used in high-level libraries. Also, Rust is a better choice for low-level code optimizations and parallelization, but falls short when it comes to front-end architectural implementations.