Rust. The promise of fearless concurrency2022-06-30
Rust has been getting 1st place in Stack Overflow’s annual developer survey “most loved programming language” since 2016. Google develops parts of Android with Rust. Amazon Web Services (AWS) has used Rust since 2017 for its serverless computing offerings, AWS Lambda and AWS Fargate. Microsoft writes components of its Azure platform including a security daemon for its Internet of Things (IoT) service.
Big addition to this popularity wave was Linus Torvald’s announcement on Open Source Summit that Rust can be added to the Linux kernel in the next major release.
So, why Rust is getting so popular?
Rust was designed by Graydon Hoare while working at Mozilla Research in 2006-2011. It is a multi-paradigm, general-purpose programming language.
Main features of Rust are:
Rust offers all of your computer’s available performance. It does not rely on a garbage collector to provide its memory safety. The Rust compiler aggressively optimizes both the size and speed of your program.
The jewel of Rust’s design is concurrency without data races. Because concurrency is much safer to use in Rust, making it a technique you can design into your code from the beginning. There is no global interpreter lock (GIL) to constrain a thread’s speed. It also provides high-level abstractions like channels and worker thread pools to make concurrency convenient to use.
Rust enables you to create programs that require minimal memory. When needed, you can use fixed-size structures and know exactly how every byte is managed. High-level constructs, such as iteration and generic types, cause minimal runtime overhead.
While Rust sounds like perfect language, it has disadvantages:
Cyclic data structures
In Rust, it is difficult to model cyclic data like an arbitrary graph structure or doubly-linked list.
Rust is slower at compiling code than its peer languages. It has a complex compiler toolchain that receives multiple intermediate representations and sends lots of code to the LLVM compiler. It requires whole-of-crate compilation.
Rust is very big! It has a rich type system, several dozen keywords, and includes some features that are unavailable in other languages. These factors all combine to create a steep learning curve.
Many companies have successfully built large software projects in Rust. Rust code is stable, fast, and light on resources. It allows you to experiment without fear. Sounds like next learning challenge.
- Rust in action by Tim McNamara
- Programming Rust: Fast, Safe Systems Development by Jim Blandy, Jason Orendorff, Leonora Tindall