Mercurial Revision Control System Continues Rust'ing For Better Performance
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.