This is an automated archive made by the Lemmit Bot.

The original was posted on /r/rust by /u/amir_valizadeh on 2025-12-21 06:34:06+00:00.


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

Category Matched Median Speedup Mean Speedup
Scalability 5 765x 1433x
Pathological 4 448x 416x
Iterations 6 436x 440x
Fraction 6 424x 413x
Financial 4 336x 385x
Scientific 4 327x 366x
Genomic 4 20x 25x
Delta 4 4x 5.5x

Top 10 Performance Wins

Benchmark statsmodels fastLowess Speedup
scale_100000 43.727s 11.4ms 3824x
scale_50000 11.160s 5.95ms 1876x
scale_10000 663.1ms 0.87ms 765x
financial_10000 497.1ms 0.66ms 748x
scientific_10000 777.2ms 1.07ms 729x
fraction_0.05 197.2ms 0.37ms 534x
scale_5000 229.9ms 0.44ms 523x
fraction_0.1 227.9ms 0.45ms 512x
financial_5000 170.9ms 0.34ms 497x
scientific_5000 268.5ms 0.55ms 489x

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.