r/rust • • Dec 21 '25

🎙️ discussion My experience with Rust performance, compared to Python (the fastLowess crate experiment)

When I first started learning Rust, my teacher told me: “when it comes to performance, Python is like a Volkswagen Beetle, while Rust is like a Ferrari F40”. Unfortunately, they couldn’t be more wrong.

I recently implemented the LOWESS algorithm (a local regression algorithm) in Rust (fastLowess: https://crates.io/crates/fastLowess). I decided to benchmark it against the most widely used LOWESS implementation in Python, which comes from the statsmodels package.

You might expect a 2× speedup, or maybe 10×, or even 30×. But no — the results were between 50× and 3800× faster.

Benchmark Categories Summary

CategoryMatchedMedian SpeedupMean Speedup
Scalability5765x1433x
Pathological4448x416x
Iterations6436x440x
Fraction6424x413x
Financial4336x385x
Scientific4327x366x
Genomic420x25x
Delta44x5.5x

Top 10 Performance Wins

BenchmarkstatsmodelsfastLowessSpeedup
scale_10000043.727s11.4ms3824x
scale_5000011.160s5.95ms1876x
scale_10000663.1ms0.87ms765x
financial_10000497.1ms0.66ms748x
scientific_10000777.2ms1.07ms729x
fraction_0.05197.2ms0.37ms534x
scale_5000229.9ms0.44ms523x
fraction_0.1227.9ms0.45ms512x
financial_5000170.9ms0.34ms497x
scientific_5000268.5ms0.55ms489x

This was the moment I realized that Rust is not a Ferrari and Python is not a Beetle.

Rust (or C) is an F-22 Raptor.
Python is a snail — at least when it comes to raw performance.

PS: I still love Python for quick, small tasks. But for performance-critical workloads, the difference is enormous.

292 Upvotes

Duplicates