4 ms·
I don’t always know how fast will be fast enough when I start a project and the risk of needing a rewrite really puts me off Python.
by pharmakom 5y ago
I don’t always know how fast will be fast enough when I start a project and the risk of needing a rewrite really puts me off Python.
- VWWHFSfQ 5y agoThis is premature optimization right
- simonh 5y agoIt's not always the sin it's made out to be. It's a matter of risk and cost. If there's a high risk performance will be an issue, and optimising later will have a high cost (or optimising early has a low cost), then it makes sense.
- adgjlsfhk1 5y agoYes and no. One of the biggest disadvantages of python is that the way people typically optimize python code is to 1. rewrite in numpy 2. rewrite in Cython (or other python compiler) 3. rewrite in C++ The problem with this workflow is that it means you end up rewriting large chunks of your code over several years in systems that have fairly different idioms. If you suspect you might in the future be performance bottle-necked, writing your code in a faster (but still productive) language to start can be a lot better because you can then improve performance more incrementally without multiple full rewrites.
- pharmakom 5y agoI don’t believe so. Choosing a language that is faster (and still productive) from the get-go has almost no cost but reduces the risk of rewrite.
- cirgue 5y agoI work in python all the time, and I’ve still not found a situation where this happened. Sometimes you might have specific components that you might want to write in other languages, but this is really rare unless you’re manually writing really computationally intensive or time critical procedures. Which hopefully you should know going into the project. Like if you’re rolling your own in-line audio processing you know up front that python is a bad choice. But any CRUD-like app? Python is plenty fast, especially if you’re relying on c implementations of heavy-lifting stuff.
- pharmakom 5y agoAny CPU heavy algorithm that does not have a clear boundary to start the C/C++ part is a poor match for Python.
- digisign 5y agoIt's a great prototyping language. Sometimes the final product will use a better algorithm because it was found easily in Python then ported to bare metal language.