Рубрики NewsTechnologies

Google believes that Rust programming language is twice as efficient as C++

Опубликовал
Ігор Шелудченко

Bergstrom said that while Dropbox in 2016 and Figma in 2018 offered early descriptions of rewriting code in memory-safe Rust-and doubts about performance and language have subsided-concerns about its reliability and security remain.

But there have been significant changes in the software development ecosystem.

For example, in a new report by the White House Office of the National Cyber Director (ONCD) called ondevelopers to use «memory-safe programming languages» and to abandon C or C++ programming tools. This advice is a step towards «protecting the building blocks of cyberspace».

According to the government, C and C++ allow arbitrary arithmetic with pointers with direct memory addresses without bounds checking. At the same time, C++ author Bjarne Straustrup criticized the US government.

«I find it strange that the authors of these resolutions do not notice the strengths of modern C++ and the efforts aimed at ensuring security», he said.

The main problem is that most security vulnerabilities in large codebases can be traced back to memory security bugs. And Rust can largely, if not completely, avoid such problems if used properly.

Back in September 2022, Microsoft Azure CTO Mark Russinovich said that software projects that may have started in C/C++ should use Rust. Now, this recommendation extends beyond new projects and calls for reworking old code.

Rust is better than C++, and Kotlin is better than Java

Lars Bergstrom notes that rewriting the Go code in Rust has shown significant benefits.

«When we rewrote systems from Go to Rust, we found that they require about the same team size and about the same amount of time to build. So there is no loss of productivity when switching from Go to Rust. And what’s interesting is that we see some benefits from this», — Bergstrom said.

According to Bergstrom, it is more important to compare the reworking of C++ code in Rust.

«In each case, we have seen a more than 2-fold reduction in the amount of effort required to create services in Rust, as well as to maintain and update those services written in Rust. This is really significant for us because C++ code is very expensive. It involves large teams and a lot of work. There are risks,— he said.

Bergstrom said that Google is conducting a similar migration, moving developers from Java to Kotlin, and that the time required to retrain developers in both cases – Java to Kotlin and C++ to Rust – was the same.

That is, after two months, about a third of developers believe that they are as productive in their new language as they were in the old one.

Disqus Comments Loading...