From Python to Rust: A 72-Hour Sprint
The common trope in software development is that porting a project to Rust often devolves into a lengthy, opinionated process, frequently yielding incomplete results. However, the Port Mortem 2026 hackathon challenged this notion. The premise: writing a port is easy; proving its correctness is the real hurdle. This challenge was met by the team behind rs-parsimonious, a complete Rust implementation of the pure-Python PEG packrat parser erikrose/parsimonious.
The hackathon’s tight 72-hour timeframe forced the team to bypass subjective debates and focus purely on execution and verification. The result was a functional Rust port, demonstrating that rapid, high-quality software migration is achievable under extreme constraints.
Engineering the Rust Port: Core Components and Strategy
The core task involved translating the logic of the Python parser into Rust. This meant meticulously mapping Python’s data structures and control flow to their Rust equivalents. Key to the success was the adoption of Rust's strong type system and ownership model, which, despite the tight deadline, provided a robust framework for ensuring memory safety and concurrency from the outset.
The strategy focused on identifying the critical components of the original parser and porting them systematically. This included the parser combinator library, the grammar definition language, and the core parsing engine. Attention was paid to preserving the behavior of the original parser as closely as possible to ensure functional parity.

Proving Correctness: Differential Fuzzing as the Key
The true innovation of this project, aligning with the hackathon’s theme, was the rigorous proof of correctness. The team employed differential fuzzing, a technique where two independent implementations of the same functionality are fed the same inputs, and their outputs are compared. Any discrepancy indicates a bug in at least one of the implementations.
In this case, the original Python parser and the new Rust port were subjected to this testing regimen. The fuzzing process generated a massive volume of diverse inputs, designed to explore edge cases and trigger potential bugs in either implementation. The results were striking: the differential fuzzing identified 20,041 critical bugs, all of which were found in the original Python parser.
This outcome is significant. It not only validates the correctness of the Rust port, rs-parsimonious, but also highlights the effectiveness of differential fuzzing as a method for verifying complex software components. The fact that all critical issues were found in the mature Python codebase, rather than the newly written Rust code, speaks volumes about the robustness of the porting process and the inherent safety features of Rust itself.
Performance Gains and Future Implications
Beyond correctness, the porting effort also yielded substantial performance improvements. While the hackathon’s primary focus was verification, the inherent efficiencies of Rust compared to Python led to a significant speedup. Benchmarks indicated that the Rust port was approximately 10-15x faster than the original Python parser. This performance uplift is a critical benefit for applications requiring high-throughput parsing, such as compilers, interpreters, and data processing pipelines.
The success of rs-parsimonious provides a compelling case study for migrating performance-critical Python libraries to Rust. It demonstrates that such migrations can be executed rapidly and with a high degree of confidence in their correctness, provided the right methodologies, like differential fuzzing, are employed. This approach can be invaluable for projects looking to leverage Rust's performance and safety guarantees without sacrificing development velocity or introducing regressions.
The project’s findings suggest a broader trend: Rust is increasingly becoming a viable and attractive option for rewriting performance bottlenecks in existing Python codebases. The ability to achieve both correctness and speed in a short timeframe offers a powerful incentive for developers and organizations to consider such migrations. The rs-parsimonious repository now stands as a testament to this potential, serving as both a functional parser and a proof-of-concept for rapid, verified porting.
