Why only use python? It's slow as fck.. #101
Replies: 3 comments 3 replies
-
You’re absolutely right—performance is an important topic, and using C/++/# for the heavy calculations could definitely make a difference since the languages are known for their speed. The optimization currently takes around 45 seconds on an older CPU core, so while that might seem a bit long, it’s still reasonable for the hourly data we’re working with right now. Since we’re only dealing with hourly updates at the moment, it’s not a huge issue, if we start running things more often, say every 10 minutes in the future, it could become more relevant. One thing to keep in mind is that the current Python code and parameters haven’t really been optimized yet. Before jumping to another language, it might be worth seeing how much we can improve with Python itself. There are lots of ways to speed things up, like using Cython or parallelizing tasks, which could give us a nice boost while keeping things flexible. In the past I often used DEAP for Python simply bc its very fast to try different algorithms. But if you want to give it a try and solve the optimizing in an other language that would be interesting! |
Beta Was this translation helpful? Give feedback.
-
Your post prompted me to review the code, and I discovered several low hanging fruits for improvement in the class_ems.py. I managed to reduce the calculation time by 50%, and I’ll be pushing a PR later today. (down to 22 seconds) Additionally, the overall optimization that includes the EMS can be found in class_optimization.py. I personally enjoy tackling performance optimization challenges, and I often invest more time in them than I should. However, I believe the project currently faces more significant issues. We should prioritize improving the overall state of the code before looking into performance optimizations. |
Beta Was this translation helpful? Give feedback.
-
I think python is ok for a first start but lacks the type safety of languages like go. I wouldn't move to c/c++ or more complex languages. go could be beneficial as it is also much easier to deploy and resilient in its maintenance. It has a very nice toolchain to improve code quality out of the box and is super easy to get into compared to c/c++ or rust. |
Beta Was this translation helpful? Give feedback.
-
Hi, I am wondering if it may be an option to code the optimizing / calculation /forecast functions in an more performant language like c++ or c# (the ones I would use) for the time consuming calculations.
I don't understand it fully, but from the 2 hour recording of the install session i've heard that it takes a "long" time to calculate.
This is the reason why I opened this discussion to put the elephant "use an more performant coding language" in the room..
In general I think is's an very interesting project!
Beta Was this translation helpful? Give feedback.
All reactions