Mercurial Revision Control System Continues Rust'ing For Better Performance

Written by Michael Larabel in Programming on 11 February 2021 at 03:19 AM EST. 40 Comments
PROGRAMMING
The Mercurial distributed revision control system continues to see use particularly around some large code-base projects and the developers continue working to optimize its performance in part by transitioning more of it to the Rust programming language.

With Mercurial traditionally being a Python program and supporting C extensions in some areas, in recent years they have been turning to making use of Rust code for achieving better performance and maintainability. Mercurial's "Oxidation Plan" ultimately calls for the main command (hg) to become a Rust binary that embeds and uses a Python interpreter when needed while Mercurial's Python code will call into Rust code.

This effort to move more performance-sensitive code from Python or C into Rust with Mercurial has been happening for a few years now while developer Raphaël Gomès presented an update/status on the effort during last weekend's virtual FOSDEM 2021 conference.

Rust is continuing to pan out to offer better performance than Python or even the C extensions. Using Rust is enabling the developers of this open-source distributed revision control system to also provide better multi-threading capabilities with little hassle. In some cases the performance improvement means dropping from around ~7.3 seconds down to as little as 53 milliseconds with the newest Rust code.

Depending upon the area of Mercurial being ported to Rust, it's generally ranging from 3~10x faster performance and also leading to memory savings benefits and more. Granted, it's compared to Python code and in some cases also optimizing the algorithms and other enhancements being made at the same time.

In any case, for those curious about the latest on Mercurial's transition to Rust can see this slide deck (PDF) from FOSDEM Online 2021.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week