Hacker News new | past | comments | ask | show | jobs | submit login

I do not get why people do these total rewrites, especially for working Python systems. Why throw out the baby with the bathwater ? Python is fundamentally a composing toolkit. Rewrite the slow bits in C++/Rust/Go and wrap it. That's how all major Python components like Numpy, Scipy, Tensorflow, PyTorch etc. does it. And that's a major reason why Python dominates today.

Align with the core strengths of Python's philosophy and its toolset and get the benefit. Why fight it ?




> Rewrite the slow bits in C++/Rust/Go and wrap it.

For reposurgeon, you can't. Not the author, but I have done some hacking on it. "The slow bits" are not things you can rewrite in a different language and wrap. They are much too integral to the code.

> That's how all major Python components like Numpy, Scipy, Tensorflow, PyTorch etc. does it.

And what all of these have in common is that the "slow bits" are not like those in reposurgeon. The wrapped speeded-up things are basically fast implementations of appropriate basic data types, like Numpy arrays and vectors. Those aren't the kinds of things that are slow in reposurgeon.


So which parts and things are the slow bits of reposurgeon? ESR seemed to be saying[1] that the last time he tried profiling it was seven years ago.

[1] http://esr.ibiblio.org/?p=8161&cpage=1#comment-2065946


"Rewrite the slow bits" only works when you have a solid hot loop that you can rewrite. But what if most of your program is the hot loop?

This particular problem is not particularly numerically oriented. There's nothing he could feed into a external library to speed it up. It is highly algorithmic code, pretty much the worst case for Python.


> Align with the core strengths of Python's philosophy and its toolset and get the benefit. Why fight it ?

In this particular case, it's worth noting that reposurgeon highlights some core weaknesses in Python's philosophy and its toolset. The two biggest are the amount of memory required for even basic objects and the GIL.


I think it is fine when people are doing rewrites on their time and dime. It is certainly better than situation where language fans just make drive-by comments to authors on github etc to rewrite stuff in xyz-lang because it is so much better.


Because nine hour runtime is really long when you're trying out different rules to make sure that the conversion happens the way you want. It's almost like a REPL with a nine-hour response time (not quite, but it's in that direction). That's so completely unworkable that a rewrite into something faster is basically your only option.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: