logoalt Hacker News

lenerdenator • yesterday at 9:41 PM • 3 replies • view on HN

People have been calling Python a "prototyping" language for decades. I'd be interested to see how many Python projects ever actually get rewritten in a more performant language. My guess is, up until the last five years that was almost never done. Even with LLMs to help, is that the best use of your tokens and humans' time? It doesn't add a feature. It could conceivably cut costs after enough time, but only if done correctly.


Replies

zahlman • today at 2:48 AM

> My guess is, up until the last five years that was almost never done.

Because having just the hot loop in the performant language is often deemed good enough. And there's tons of Python code out there where the "hot loop" is already automatically in C (the various operations implemented in C by the runtime) or where you can get close enough e.g. with Numpy. Consider that things like Pygame can exist; for a lot of the games people want to make, the only thing that really needs to happen anywhere near "bare-metal" speed is blitting.

nrawe • yesterday at 10:18 PM

Doing it currently, Python to Go. Early indications are a 50-98% increase in speed (e.g. one testcase went from 26hrs to 30mins) for network/CPU heavy workload. Conversion via Qwem, lots of testing needed but compute savings will be worth it.

➕ show 2 replies
ActorNightly • today at 5:41 AM

> My guess is, up until the last five years that was almost never done.

It was done plenty. Just with extensions to python like numpy and opencv. There is no reason to translate everything versus just the critical pieces.