5 ms·
You ignored an important lesson IMO. Use the right tool for the job. Your entire journey here is battling with Python and not the problem space. Your improvem
by sigg3 3y ago
You ignored an important lesson IMO.
Use the right tool for the job.
Your entire journey here is battling with Python and not the problem space. Your improvements are solely measured by how your code leaves Python problem solving space, so you end up writing what's probably unpythonic and unmaintainable Python.
Why?
Rewrite in Go, Rust or C++ or whatever.
If you need to go faster than Python, don't use Python. Python is great for everything else. Its overhead and sluggish execution are consequences of its greatest strength.
- carlmr 3y agoExactly my thought. Whenever I see wild optimization goose chases it's Python causing all the issues. The problem is that a lot is still possible to optimize "in Python" although as you say the code becomes less and less readable to your average Python developer, so that people don't notice they just picked the wrong tool for the job. You need more speed? Use multiprocessing? Allocate memory appropriately? Rust, or if you like pain, C or C++.
- Etherlord87 3y agoYou need to tell that to the authors TensorFlow.
- pzo 3y agoDoesn't Tensorflow has C++ API? I think tensorflow and pytorch under the hood using c++/c. Tensorflow has even official Rust bindings. The same applies to libraries like Open3d and OpenCV - although mostly people consume their python API under the hood is very optimized C++ code parallelized for many CPU and SIMD instructions.