Why do banks insist on using C++ when Rust is twice as efficient?
The programming language Rust has been on the verge of big breakthrough for years now and, in the world of big tech, that breakthrough might be just around the corner. Lars Bergstrom, a director of engineering at Google, said earlier this year that, when rewriting C++ code, his team has seen a "decrease by more than 2x in the amount of effort required" to build and maintain it in Rust. It's a tale of two extremes with the language, however; Rust code is very easy to maintain, but very hard to build.
Click here to follow our new WhatsApp channel, and get instant news updates straight to your phone 📱.
Austin Starks, an engineer at HealthTech firm Oscar Health, built an AI trading platform in Rust as a side-gig. After 18 months of development, he said that Rust has "atrocious semantics" and you "have to do backflips to figure out how to make the dang code work..." hardly a decrease in effort.
After two years with the language, however, he came around to Rust. With a finished product built, he said Rust made his platform "scalable, configurable and lightning-fast." He said "maintaining a Rust app is like getting kisses from a butterfly;" in contrast, he said that building the platform in C++ might have led to him "scrap[ping] it altogether after my program crashes for the 18th time due to a segfault."
Building Rust systems in a large bank brings even more inherent complications. We spoke to Steve Taylor, a Rust engineer rewriting some low-latency C++ trading systems in Rust for a major bank, about the benefits and challenges the language poses compared to the industry standard C++.
How Rust is better than C++
As you likely already know, Rust's key benefit over C++ is its safety. Taylor says "Rust, once written, turns a large percentage of very difficult to trace bugs into compile time bugs," meaning you won't be able to run the code properly until they're dealt with. The bugs it most effectively targets are ones where the code "can work 100 times" but incite "hell on earth" on the 101st. Using Rust will "eliminate an entire category of runtime issues." The compiler is (almost) "bulletproof," providing a certain level of comfort once it's up and running.
C++ is meant to be the fast language, but Taylor says "well written Rust code is as fast, sometimes faster." This is because Rust enforces having only one mutable reference, allowing it to "optimize code in ways it can't do in C++." For example, this approach prevents data races, making your performance much more predictable, and thus, improvable.
Rust is not easy to get to grips with, but if you can handle it, the rewards are exponential. Taylor says you "pay a hefty cost with the learning curve before you get the productivity benefit." Ultimately, Taylor says Rust "formalizes what you should be doing in C++ anyway."
Getting the best out of Rust requires a different mindset than other languages require. Starks, a Go developer by trade, says he likes "to move fast and break things," but using Rust is akin to "running a 100-meter dash in a 4ft deep Olympic swimming pool."
How C++ is better than Rust
Rust's benefits have their inherent drawbacks; with its safety comes a great deal of frustration. Taylor says that even when you "know for a fact the code will be fine," the potential for a 1 in a million bug can halt progress. Rust has a reputation for being nice to its coders but he disagrees; he says that while "C++ takes you by the hand, Rust takes you by the throat."
The learning curve is perhaps the most significant barrier to widespread adoption. Taylor says "it's very hard to learn rust if you're not being paid to." His first exposure to the language came when he built a crypto trading platform, a job he initially thought he would be doing in C++. Its difficulty causes casual coders to give up early and disincentivizes larger companies from using it, as the process of training up its employees becomes more arduous and costly.
Technologists in the prop trading space are beginning to experiment with Rust, but due to a lack of Rust jobs with elite pay (and a comparative abundance of C++ ones), it's hard to guarantee those experiments become anything more than just that. Still, there are a few high-paying roles in Rust; the highest available salary for a Rust developer on eFinancialCareers is £250k ($318k)
According to the Stack Overflow 2024 survey, Rust is the 13th highest paying programming language and pays well above the likes of Python and Java, but data from Revelio labs suggests just 0.14% of tech jobs in finance use the language.
Seeking online advice to improve your rust code can be a challenge because of Rust's prickly fanbase. Starks called the Rust community "a bunch of narcissistic assholes that hate being told their favorite language has flaws," and advised that you don't go to online forums looking for help. Instead, he suggested using AI bots like Claude, but even this requires practice; Starks said that you'll need to work on "articulat[ing your] requirements better, and in turn, [you'll] get better answers from these models."
Taylor adds that C++ is "more graceful" while both he and Starks described Rust as "verbose." C++ also has a more extensive set of libraries, meaning you might find yourself having to build a lot more from scratch using Rust, especially if you're a fan of lesser used techniques.
Will Rust jobs in finance ever become popular?
In finance, Taylor says there's "enthusiasm for Rust, and frustration at how few Rust programmers are available." When hiring for Rust jobs in the past, he said he would receive "three Rust CVs in three or four months... and about 50 C++ CVs."
Taylor predicts Rust will become more common in the future. But unfortunately (and especially as people begin to suggest coding itself is going out of fashion) it may always remain on the fringe.