logoalt Hacker News

Kwpolska • yesterday at 6:40 PM • 1 reply • view on HN

If Python is too slow to write a package manager in, why bother writing anything in it? Why not just write your own code in Rust or whatever?


Replies

kstrauser • yesterday at 9:15 PM

I've written Python for +- 30 years. In that time, there was exactly one time where a project I was writing was compute-bound to the point that I had to rewrite the inner bits in another language. I spun that off into its own open source project.

In every other situation, ever, in that stretch of time writing Python every day of my professional life, it's been fast enough. It's always IO-bound, waiting on a web service to return, or a DB query to finish, or a shell command to output something, etc., whether I've been writing web backends, or data processing pipelines, or security analyzers, or anything else.

At one company, I was hacking on a production product that received about 80,000 requests per second from remote clients. At another, we build a service that could scale up and down quickly to handle traffic burst that swung between 0 requests per second and around 3,000,000. At still another, we were shoving a few hundred TB of data through an ETL system. In each of those cases, it was fast enough as the main thing gluing the other various backend systems together that we had zero interest in rewriting it in something "faster". It simply never came up. It got the job done.

So my summarized answer would be that package management, ironically, is one of the only times I ever noticed Python being slow. Turns out constraint solvers can bog down pretty quickly. uv does lots of clever things that make it ridiculously fast, and things like poetry could use some of those same ideas to be, say, 10x to 20x slower than uv, which would still be really fast. It kinda sucked all the air out of the room, though. Rewriting it in Python would make it slower, and also require installing an installed, working Python version to run the package manager so that it could manage Python installations. Escaping that ouroboros with a single-file executable that can bootstrap the whole thing from scratch is pretty freaking nice, and I don't hear people clamoring to go back to the old ways.

➕ show 1 reply