Let me start with a confession: I love Python. It's the language that got me building things in the first place. Most of my tools started as quick Python scripts, and some of them grew into real packages that people actually install and use.
(I know this gif is something ๐, but I didn't find a better example than this.)
So when I say I rewrote parts of them in Rust, please don't read it as "Python bad, Rust good." It's not that simple. This is the story of what hurt, what I tried first, and why I ended up making the switch for Ultimate Media Downloader (UMD) and the helper binary that powers downloads inside my Mac app, Aura.
It started with a small annoyance
It wasn't a big dramatic moment. It was a bunch of tiny annoyances:
- A simple
checkcommand that took 350-900 ms to start before doing anything - A bundled helper that weighed 35-60 MB just to answer small questions
- Users asking, "Is it supposed to take this long?"
When a tool is for yourself, you shrug and wait. When other people use it, every extra moment is something you're responsible for. And Aura calls its helper constantly, so those delays added up.
What I tried before leaving Python
I didn't jump straight to a rewrite. That would have been silly. First I tried:
- Profiling. I found the real hot spots instead of guessing.
- Better algorithms. Some of the slowness was my own fault, and I fixed it.
- Caching and lazy imports. This helped startup time a bit.
- Multiprocessing and async. It helped in places, but added complexity and its own bugs.
- Native extensions and optimized libraries. Useful, but they only go so far.
After all that, the remaining cost wasn't my code. It was Python itself: the interpreter, the runtime, and the way I had to package it.
Reason 1: Raw speed and a tiny footprint
Aura ships a helper (umd_bridge.py) that I bundled with PyInstaller in --onefile mode, so users wouldn't need Python installed. It works, but every call has a hidden cost. macOS has to unpack the whole archive into /tmp and boot a Python VM before my code even starts.
Rust compiles to native machine code, so none of that exists. The helper just runs.
| Metric | Python (PyInstaller --onefile) |
Rust (native) | Basis |
|---|---|---|---|
| Binary size | ~35-60 MB | 672 KB | Rust measured, Python estimated |
| Peak RAM per call | ~45-75 MB | 2.0 MB | Rust measured (/usr/bin/time -l), Python estimated |
Cold start for check
|
~350-900 ms | ~10 ms wall, 0.00 s CPU | Rust measured, Python estimated |
| Startup work | Unpacks to /tmp and boots a Python VM |
None, runs directly | Design |
To be upfront: the Rust numbers are measured, and the Python numbers are estimates from typical PyInstaller behavior. Even with generous error bars on the Python side, the gap is huge.
Reason 2: No interpreter to boot
Quick checks like check and platforms don't need heavy machinery. In the Python version, each one still paid the full startup tax. In the new design, check runs in-process in Swift with no process spawn at all, and the heavier commands go through a tiny Rust binary that starts instantly and exits when it's done.
When a download does happen, the Rust helper hands off to yt-dlp and ffmpeg and streams their output line by line through a small buffer. It stays light, and when it finishes there's nothing left running.
Reason 3: Memory usage
Python objects and the bundled runtime carry overhead. My Rust helper uses roughly 95% less memory per call: about 2.0 MB versus an estimated 45-75 MB. For a menu-bar-style app that's meant to sit quietly on people's Macs, that matters a lot.
Reason 4: One binary, zero "it works on my machine"
This one made me happiest. Distributing Python tools means dealing with:
- Which Python version does the user have?
- Dependency conflicts
- Virtual environments
- "pip not found" or "externally managed environment" errors
With Rust, I ship a single compiled binary. It lives inside Aura.app at Resources/umd-helper, exactly where the old one was, so nothing about how the app is delivered changed. No Python needed on the user's Mac, and the wire protocol stayed the same, so the rest of the app didn't have to care.
Reason 5: The compiler is a strict but fair teacher
Rust's compiler is famous for being picky. At first it drove me crazy. But after a while I realized something: a whole category of bugs just doesn't make it past compilation. Null pointer surprises, forgotten error cases, and race conditions get caught before a user ever sees them.
In Python, many of those bugs show up at runtime, usually in front of the one user who does something unexpected.
It wasn't all smooth
I'd be lying if I said the switch was painless:
- The learning curve is real. Ownership and borrowing took me a while to understand. I lost hours to errors that felt like the compiler arguing with me.
- Development is slower at first. Python lets me prototype in minutes. Rust makes me think before I write.
- Compile times. Waiting for builds is a different kind of waiting than a slow script, but it's still waiting.
-
Ecosystem gaps. Some things I get in Python with one
pip installrequired more work in Rust.
What I didn't rewrite
I didn't throw Python away. I kept it where it makes sense:
- Quick scripts and automation
- Prototyping new ideas
- Glue code and tooling
- Anything where speed simply doesn't matter
My rule now: prototype in Python, rewrite in Rust when performance, reliability, or distribution starts to hurt.
What I'd tell you if you're thinking about it
- Measure first. Don't rewrite because Rust is trendy. Rewrite because you have a real, measured problem.
- Start small. Move one hot path or one module, not the whole project. Tools like PyO3 and maturin let you call Rust from Python.
- Keep your tests. Use your existing tests to check that the Rust version behaves identically.
- Be patient with yourself. The first week is painful. By the third, it clicks.
Final thoughts
Was it worth it? For UMD and Aura's helper, absolutely. The tools start faster, weigh a fraction of what they did, are easier to ship, and I sleep better knowing the compiler caught the bugs before my users did.
Python is still my first love for getting ideas out quickly. Rust is what I reach for when an idea has grown up and needs to be fast and solid.
If you've made a similar switch, or you're thinking about one, I'd love to hear about it. Drop a comment or find me on GitHub.







Top comments (0)