Sharing memories of Python and Rust The story of a lifetime inside Mercurial

Discover how the Mercurial project leveraged Rust to improve performance by up to an order of magnitude, and learn about the benefits of combining Python and Rust in a version control system.

Key takeaways
  • Rust is a great language for writing version control systems due to its performance capabilities.
  • The Mercurial project originally started with Python, but Rust was introduced to improve performance.
  • Rust’s strong type system and statically compiled binaries provide a significant performance boost.
  • The introduction of Rust helped improve Mercurial’s performance by up to an order of magnitude.
  • The main reasons for choosing Rust were due to its ability to interface with C and Python’s global interpreter.
  • The Mercurial project uses a combination of Python and Rust, with Rust implemented in several areas, including iterators, sets, and classes.
  • The project aims to create a more performant and scalable version control system.
  • The use of Rust has allowed the team to simplify imports and do less work, resulting in better performance.
  • The FFI layer can be a bottleneck, and the team tries to minimize its usage.
  • The Mercurial project is working towards distributing the Python version of the service.
  • Using PyOxidizer will help with packaging and distribution of the service.
  • The team plans to continue improving the performance of Mercurial using Rust.
  • The introduction of Rust has been well-received, and the team is excited about its potential.