points by lenerdenator 2 days ago | 0 comments
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.
[–] zahlman 2 days ago
[–] ActorNightly 2 days ago
> 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.
[–] nrawe 2 days ago
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.
[–] mynegation 2 days ago
Did you mean “50-98% decrease in running time”? Just calculating from your 26hrs to 30 mins seems to imply so. In terms of speed that translates to 100% to 5100% increase in speed.
[–] gf000 2 days ago
Why not go with something like graalpy first? That's much less risk in terms of "we end up slightly changing behavior"
[–] nrawe 1 day ago
It's the same level of testing for us for either Python2->3 or Go (it's a legacy code base, low automated coverage).
Conversion is now (somewhat) easier, the testing will be the slow part. For the speed improvements, which we also need for a migration from on-prem to cloud, it's a no brainer vs the other options at our disposal (like GraalPy).
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.