Switching From C++ to Rust: Doubling Development Efficiency

Google’s Android Engineering Director Lars Bergstrom recently shared the company’s experience migrating projects written in Go or C++ to the Rust programming language at the Rust Nation conference.

Switching From C++ to Rust: Doubling Development Efficiency

Bergstrom stated that although there were cases of rewriting code in the memory-safe Rust language as early as 2016 with Dropbox and 2018 with Figma, and the doubts about productivity and this language have faded, concerns about its reliability and safety have persisted.

However, with some organizations and US government agencies frequently signaling to “switch from C/C++ to memory-safe languages like Rust,” Bergstrom believes that the perception of the entire software development ecosystem has shifted.

Internally at Google, after rewriting Go code, which is considered memory-safe but performs poorly, into Rust code, some advantages have been observed.

Bergstrom indicated that the labor and time consumed in building systems with Go and Rust are comparable; switching from Go to Rust does not reduce work efficiency.

“Interestingly, we have indeed seen some benefits. We noticed a reduction in memory usage in the services migrated from Go… We also observed that over time, the defect rates of those services rewritten in Rust have decreased, thus improving correctness.”

It is noteworthy to compare the rewriting of C++ code into Rust code. “In every case, we found that whether building services with Rust or maintaining and updating those services written in Rust, the required workload has decreased by more than 2 times.”

Bergstrom mentioned that this finding is significant for the Google team, as maintaining C++ code is costly, requiring large teams to invest considerable effort and poses many risks.

Additionally, 85% of developers express greater confidence in the correctness of Rust code compared to other languages. “This is a huge number… I have experienced language surveys more than once in my life, but I have never seen such a number.”

Related linkhttps://www.youtube.com/watch?v=6mZRWFQRvmw&t=27048s

Popular Articles

An intern at an open-source company submitted PRs to other open-source projects during work hours, and the CEO requested to close them after discovering this.

Created an open-source version of “Douyin” using the Vue family of tools entirely by hand.

The AI programming language Mojo officially releases its standard library, claiming to be 90,000 times faster than Python.

The active maintainer of xz “lurks” for three years—adding malicious code and implanting SSH backdoors.

The iOS version of Firefox is riddled with a lot of “spaghetti code.”

⬇️ Long press the QR code to start!
Switching From C++ to Rust: Doubling Development Efficiency

Leave a Comment